From a6c342cdb64532b27419324a50c146542b8e7ea3 Mon Sep 17 00:00:00 2001 From: a-51-50 Date: Mon, 4 Apr 2022 02:50:38 +0200 Subject: [PATCH 1/2] If command doesnt exist execute help --- prvd/common/prompt.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prvd/common/prompt.go b/prvd/common/prompt.go index 46680bd..a8a02a9 100644 --- a/prvd/common/prompt.go +++ b/prvd/common/prompt.go @@ -64,9 +64,10 @@ func CmdExists(cmd *cobra.Command, args []string) (bool, string) { } func CmdExistsOrExit(cmd *cobra.Command, args []string) { - exists, command := CmdExists(cmd, args) + exists, _ := CmdExists(cmd, args) if !exists { - fmt.Printf("%s is not a valid command", command) + // if command doesn't exist, try to execute help + cmd.Help() os.Exit(1) } } From 495d27ebfb7bb1dc3efc9fe803679f4fe1c0765a Mon Sep 17 00:00:00 2001 From: a-51-50 Date: Mon, 4 Apr 2022 02:50:53 +0200 Subject: [PATCH 2/2] Change comment --- prvd/common/prompt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prvd/common/prompt.go b/prvd/common/prompt.go index a8a02a9..3394d4a 100644 --- a/prvd/common/prompt.go +++ b/prvd/common/prompt.go @@ -66,7 +66,7 @@ func CmdExists(cmd *cobra.Command, args []string) (bool, string) { func CmdExistsOrExit(cmd *cobra.Command, args []string) { exists, _ := CmdExists(cmd, args) if !exists { - // if command doesn't exist, try to execute help + // if command doesn't exist, execute help cmd.Help() os.Exit(1) }