From 32470ac2560c1ec2c129c640dd0476e9675ca8dd Mon Sep 17 00:00:00 2001 From: "dr.max" Date: Mon, 5 Aug 2019 01:44:55 -0700 Subject: [PATCH] fix(bug) correct response for unknown command or plugin fixes(#309) (#322) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```bash ➜ client git:(issue309) ✗ ./kn lol Manage your Knative building blocks: * Serving: Manage your services and release new software to them. * Eventing: Manage event subscriptions and channels. Connect up event sources. Usage: ... Use "kn [command] --help" for more information about a command. unknown sub-command or plugin "lol" for "kn" ``` --- pkg/kn/core/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/kn/core/root.go b/pkg/kn/core/root.go index 2f5485fe7..3a3ed4787 100644 --- a/pkg/kn/core/root.go +++ b/pkg/kn/core/root.go @@ -76,7 +76,9 @@ func NewDefaultKnCommandWithArgs(rootCmd *cobra.Command, if _, _, err := rootCmd.Find(cmdPathPieces); err != nil { err := plugin.HandlePluginCommand(pluginHandler, cmdPathPieces) if err != nil { - fmt.Fprintf(errOut, "%v\n", err) + rootCmd.Help() + fmt.Println() + fmt.Printf("unknown command or plugin \"%s\" for \"kn\"\n", args[1]) os.Exit(1) } }