diff --git a/cmd/alias-set.go b/cmd/alias-set.go index 88f63818..ba39b1cb 100644 --- a/cmd/alias-set.go +++ b/cmd/alias-set.go @@ -61,10 +61,8 @@ var aliasSetCmd = cli.Command{ HideHelpCommand: true, CustomHelpTemplate: `NAME: {{.HelpName}} - {{.Usage}} - USAGE: {{.HelpName}} ALIAS URL ACCESSKEY SECRETKEY - FLAGS: {{range .VisibleFlags}}{{.}} {{end}} @@ -73,24 +71,20 @@ EXAMPLES: {{.DisableHistory}} {{.Prompt}} {{.HelpName}} myminio http://localhost:9000 minio minio123 {{.EnableHistory}} - 2. Add MinIO service under "myminio" alias, to use dns style bucket lookup. For security reasons turn off bash history momentarily. {{.DisableHistory}} {{.Prompt}} {{.HelpName}} myminio http://localhost:9000 minio minio123 --api "s3v4" --path "off" {{.EnableHistory}} - 3. Add Amazon S3 storage service under "mys3" alias. For security reasons turn off bash history momentarily. {{.DisableHistory}} {{.Prompt}} {{.HelpName}} mys3 https://s3.amazonaws.com \ BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 {{.EnableHistory}} - 4. Add Amazon S3 storage service under "mys3" alias, prompting for keys. {{.Prompt}} {{.HelpName}} mys3 https://s3.amazonaws.com --api "s3v4" --path "off" Enter Access Key: BKIKJAA5BMMU2RHO6IBB Enter Secret Key: V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 - 5. Add Amazon S3 storage service under "mys3" alias using piped keys. {{.DisableHistory}} {{.Prompt}} echo -e "BKIKJAA5BMMU2RHO6IBB\nV8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12" | \ @@ -103,6 +97,11 @@ EXAMPLES: func checkAliasSetSyntax(ctx *cli.Context, accessKey string, secretKey string, deprecated bool) { args := ctx.Args() argsNr := len(args) + + if argsNr == 0 { + cli.ShowCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + } + if argsNr > 4 || argsNr < 2 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), "Incorrect number of arguments for alias set command.")