From 96da45309586794612d1133c37bcfb328606f144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Skrz=C4=99tnicki?= Date: Wed, 16 Mar 2022 11:22:36 +0100 Subject: [PATCH] Show usage on invalid command line invocation. --- 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 9fbf339d00778..ee600398c4c33 100644 --- a/tool/tbot/main.go +++ b/tool/tbot/main.go @@ -107,6 +107,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 282622c9bd81a..ea0dd23080474 100644 --- a/tool/tsh/tsh.go +++ b/tool/tsh/tsh.go @@ -626,6 +626,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) }