From e6288fa5f37a32598a99658d9692ffcdc832d20e Mon Sep 17 00:00:00 2001 From: Sveinn Date: Wed, 21 Feb 2024 18:35:53 -0800 Subject: [PATCH] add help menu to put command when no parameters are present (#4852) --- cmd/put-main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/put-main.go b/cmd/put-main.go index 27700e16..8e3bce9e 100644 --- a/cmd/put-main.go +++ b/cmd/put-main.go @@ -77,6 +77,11 @@ EXAMPLES: // mainPut is the entry point for put command. func mainPut(cliCtx *cli.Context) error { + args := cliCtx.Args() + if len(args) < 2 { + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code. + } + ctx, cancelPut := context.WithCancel(globalContext) defer cancelPut() // part size @@ -97,7 +102,6 @@ func mainPut(cliCtx *cli.Context) error { encKeyDB, err := getEncKeys(cliCtx) fatalIf(err, "Unable to parse encryption keys.") - args := cliCtx.Args() if len(args) < 2 { fatalIf(errInvalidArgument().Trace(args...), "Invalid number of arguments.") }