From 6e6548c51da643bea83c7ed550d1354e82f4e564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Skrz=C4=99tnicki?= Date: Wed, 23 Mar 2022 08:41:44 +0100 Subject: [PATCH] Show usage on invalid command line invocation. (#11174) (#11333) --- tool/tbot/main.go | 1 + tool/tctl/common/tctl.go | 1 + tool/teleport/common/teleport.go | 1 + tool/tsh/tsh.go | 1 + 4 files changed, 4 insertions(+) diff --git a/tool/tbot/main.go b/tool/tbot/main.go index 461754b4aa0e3..c38b0e525c8a8 100644 --- a/tool/tbot/main.go +++ b/tool/tbot/main.go @@ -99,6 +99,7 @@ func Run(args []string) error { command, err := app.Parse(args) if err != nil { + app.Usage(args) return trace.Wrap(err) } diff --git a/tool/tctl/common/tctl.go b/tool/tctl/common/tctl.go index 83346dba36700..ea7c8855eeb47 100644 --- a/tool/tctl/common/tctl.go +++ b/tool/tctl/common/tctl.go @@ -139,6 +139,7 @@ func Run(commands []CLICommand) { // parse CLI commands+flags: selectedCmd, err := app.Parse(os.Args[1:]) if err != nil { + app.Usage(os.Args[1:]) utils.FatalError(err) } diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index 09aa21f954fb9..b159fb3be750c 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -296,6 +296,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con // parse CLI commands+flags: command, err := app.Parse(options.Args) if err != nil { + app.Usage(options.Args) utils.FatalError(err) } diff --git a/tool/tsh/tsh.go b/tool/tsh/tsh.go index 131ffad8972fb..bf4d111bc9f9d 100644 --- a/tool/tsh/tsh.go +++ b/tool/tsh/tsh.go @@ -616,6 +616,7 @@ func Run(args []string, opts ...cliOption) error { // parse CLI commands+flags: command, err := app.Parse(args) if err != nil { + app.Usage(args) return trace.Wrap(err) }