diff --git a/cmd/admin-bucket-info.go b/cmd/admin-bucket-info.go index b3f21fda..fa5dcbe7 100644 --- a/cmd/admin-bucket-info.go +++ b/cmd/admin-bucket-info.go @@ -142,7 +142,7 @@ EXAMPLES: // checkAdminBucketInfoSyntax - validate all the passed arguments func checkAdminBucketInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-bucket-quota.go b/cmd/admin-bucket-quota.go index 1eedd257..f3b6d00c 100644 --- a/cmd/admin-bucket-quota.go +++ b/cmd/admin-bucket-quota.go @@ -108,7 +108,7 @@ EXAMPLES: // checkAdminBucketQuotaSyntax - validate all the passed arguments func checkAdminBucketQuotaSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-bucket-remote-add.go b/cmd/admin-bucket-remote-add.go index 88a5256a..1165cc12 100644 --- a/cmd/admin-bucket-remote-add.go +++ b/cmd/admin-bucket-remote-add.go @@ -114,7 +114,7 @@ EXAMPLES: func checkAdminBucketRemoteAddSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr < 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 2 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-bucket-remote-bandwidth.go b/cmd/admin-bucket-remote-bandwidth.go index 7a4bdb7f..9d8ec7ac 100644 --- a/cmd/admin-bucket-remote-bandwidth.go +++ b/cmd/admin-bucket-remote-bandwidth.go @@ -140,10 +140,10 @@ func checkAdminBwInfoSyntax(ctx *cli.Context) { u != "Bi" && u != "B" && u != "" { - showCommandHelpAndExit(ctx, "bandwidth", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } if len(ctx.Args()) > 1 || len(ctx.Args()) == 0 { - showCommandHelpAndExit(ctx, "bandwidth", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } } diff --git a/cmd/admin-bucket-remote-edit.go b/cmd/admin-bucket-remote-edit.go index 2f0ad9ac..9a834013 100644 --- a/cmd/admin-bucket-remote-edit.go +++ b/cmd/admin-bucket-remote-edit.go @@ -109,7 +109,7 @@ EXAMPLES: func checkAdminBucketRemoteEditSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr > 2 || argsNr == 0 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if !ctx.IsSet("arn") { fatalIf(errInvalidArgument().Trace(ctx.Args()...), "--arn flag needs to be set") diff --git a/cmd/admin-bucket-remote-ls.go b/cmd/admin-bucket-remote-ls.go index f05bf495..9a7796e7 100644 --- a/cmd/admin-bucket-remote-ls.go +++ b/cmd/admin-bucket-remote-ls.go @@ -66,7 +66,7 @@ EXAMPLES: // checkAdminBucketRemoteListSyntax - validate all the passed arguments func checkAdminBucketRemoteListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-bucket-remote-rm.go b/cmd/admin-bucket-remote-rm.go index 09cbbd14..8bbe10a1 100644 --- a/cmd/admin-bucket-remote-rm.go +++ b/cmd/admin-bucket-remote-rm.go @@ -57,7 +57,7 @@ EXAMPLES: // checkAdminBucketRemoteRemoveSyntax - validate all the passed arguments func checkAdminBucketRemoteRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-cluster-bucket-export.go b/cmd/admin-cluster-bucket-export.go index 099013aa..7b2cf508 100644 --- a/cmd/admin-cluster-bucket-export.go +++ b/cmd/admin-cluster-bucket-export.go @@ -58,7 +58,7 @@ EXAMPLES: func checkBucketExportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-cluster-bucket-import.go b/cmd/admin-cluster-bucket-import.go index 7f1124cc..642c5c30 100644 --- a/cmd/admin-cluster-bucket-import.go +++ b/cmd/admin-cluster-bucket-import.go @@ -60,7 +60,7 @@ EXAMPLES: func checkBucketImportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-cluster-iam-export.go b/cmd/admin-cluster-iam-export.go index 68fbc14f..172f74d1 100644 --- a/cmd/admin-cluster-iam-export.go +++ b/cmd/admin-cluster-iam-export.go @@ -57,7 +57,7 @@ EXAMPLES: func checkIAMExportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-cluster-iam-import.go b/cmd/admin-cluster-iam-import.go index c9a9aba8..7ad50c0f 100644 --- a/cmd/admin-cluster-iam-import.go +++ b/cmd/admin-cluster-iam-import.go @@ -55,7 +55,7 @@ EXAMPLES: func checkIAMImportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-export.go b/cmd/admin-config-export.go index 3794a105..3a051d4e 100644 --- a/cmd/admin-config-export.go +++ b/cmd/admin-config-export.go @@ -97,7 +97,7 @@ func (u configExportMessage) JSON() string { // checkAdminConfigExportSyntax - validate all the passed arguments func checkAdminConfigExportSyntax(ctx *cli.Context) { if !ctx.Args().Present() || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-get.go b/cmd/admin-config-get.go index 18fec92f..76525d50 100644 --- a/cmd/admin-config-get.go +++ b/cmd/admin-config-get.go @@ -111,7 +111,7 @@ func (u configGetMessage) JSON() string { // checkAdminConfigGetSyntax - validate all the passed arguments func checkAdminConfigGetSyntax(ctx *cli.Context) { if !ctx.Args().Present() || len(ctx.Args()) < 1 { - showCommandHelpAndExit(ctx, "get", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-history.go b/cmd/admin-config-history.go index 58ca0fa6..55e03df8 100644 --- a/cmd/admin-config-history.go +++ b/cmd/admin-config-history.go @@ -109,7 +109,7 @@ func (u configHistoryMessage) JSON() string { // checkAdminConfigHistorySyntax - validate all the passed arguments func checkAdminConfigHistorySyntax(ctx *cli.Context) { if !ctx.Args().Present() || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "history", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-import.go b/cmd/admin-config-import.go index 97c3c685..3477e869 100644 --- a/cmd/admin-config-import.go +++ b/cmd/admin-config-import.go @@ -78,7 +78,7 @@ func (u configImportMessage) JSON() string { // checkAdminConfigImportSyntax - validate all the passed arguments func checkAdminConfigImportSyntax(ctx *cli.Context) { if !ctx.Args().Present() || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-reset.go b/cmd/admin-config-reset.go index 2f1e901b..be46ca7a 100644 --- a/cmd/admin-config-reset.go +++ b/cmd/admin-config-reset.go @@ -92,7 +92,7 @@ func (u configResetMessage) JSON() string { // checkAdminConfigResetSyntax - validate all the passed arguments func checkAdminConfigResetSyntax(ctx *cli.Context) { if !ctx.Args().Present() { - showCommandHelpAndExit(ctx, "reset", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-restore.go b/cmd/admin-config-restore.go index d5e9441a..72085a9d 100644 --- a/cmd/admin-config-restore.go +++ b/cmd/admin-config-restore.go @@ -77,7 +77,7 @@ func (u configRestoreMessage) JSON() string { // checkAdminConfigRestoreSyntax - validate all the passed arguments func checkAdminConfigRestoreSyntax(ctx *cli.Context) { if !ctx.Args().Present() || len(ctx.Args()) > 2 { - showCommandHelpAndExit(ctx, "restore", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-config-set.go b/cmd/admin-config-set.go index a61b177c..e12a4b29 100644 --- a/cmd/admin-config-set.go +++ b/cmd/admin-config-set.go @@ -88,7 +88,7 @@ func (u configSetMessage) JSON() string { // checkAdminConfigSetSyntax - validate all the passed arguments func checkAdminConfigSetSyntax(ctx *cli.Context) { if !ctx.Args().Present() && len(ctx.Args()) < 1 { - showCommandHelpAndExit(ctx, "set", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-decom-cancel.go b/cmd/admin-decom-cancel.go index c04f34db..80d71066 100644 --- a/cmd/admin-decom-cancel.go +++ b/cmd/admin-decom-cancel.go @@ -56,7 +56,7 @@ EXAMPLES: // checkAdminDecommissionCancelSyntax - validate all the passed arguments func checkAdminDecommissionCancelSyntax(ctx *cli.Context) { if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-decom-start.go b/cmd/admin-decom-start.go index bfb18f58..c1635936 100644 --- a/cmd/admin-decom-start.go +++ b/cmd/admin-decom-start.go @@ -52,7 +52,7 @@ EXAMPLES: // checkAdminDecommissionStartSyntax - validate all the passed arguments func checkAdminDecommissionStartSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-decom-status.go b/cmd/admin-decom-status.go index aae5556d..8e2b6a06 100644 --- a/cmd/admin-decom-status.go +++ b/cmd/admin-decom-status.go @@ -57,7 +57,7 @@ EXAMPLES: // checkAdminDecommissionStatusSyntax - validate all the passed arguments func checkAdminDecommissionStatusSyntax(ctx *cli.Context) { if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-group-add.go b/cmd/admin-group-add.go index 72de5d25..378082c0 100644 --- a/cmd/admin-group-add.go +++ b/cmd/admin-group-add.go @@ -54,7 +54,7 @@ EXAMPLES: // checkAdminGroupAddSyntax - validate all the passed arguments func checkAdminGroupAddSyntax(ctx *cli.Context) { if len(ctx.Args()) < 3 { - showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-group-enable.go b/cmd/admin-group-enable.go index 491e7322..0d780888 100644 --- a/cmd/admin-group-enable.go +++ b/cmd/admin-group-enable.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminGroupEnableSyntax - validate all the passed arguments func checkAdminGroupEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-group-info.go b/cmd/admin-group-info.go index f759b01d..e2fe4bd8 100644 --- a/cmd/admin-group-info.go +++ b/cmd/admin-group-info.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminGroupInfoSyntax - validate all the passed arguments func checkAdminGroupInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-group-list.go b/cmd/admin-group-list.go index 4e53c9f6..67a0d156 100644 --- a/cmd/admin-group-list.go +++ b/cmd/admin-group-list.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminGroupListSyntax - validate all the passed arguments func checkAdminGroupListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-group-remove.go b/cmd/admin-group-remove.go index 559e8636..794c29df 100644 --- a/cmd/admin-group-remove.go +++ b/cmd/admin-group-remove.go @@ -53,7 +53,7 @@ EXAMPLES: // checkAdminGroupRemoveSyntax - validate all the passed arguments func checkAdminGroupRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) < 2 { - showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 21ab1416..71444e90 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -105,14 +105,14 @@ EXAMPLES: func checkAdminHealSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "heal", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } // Check for scan argument scanArg := ctx.String("scan") scanArg = strings.ToLower(scanArg) if scanArg != scanNormalMode && scanArg != scanDeepMode { - showCommandHelpAndExit(ctx, "heal", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-idp-info.go b/cmd/admin-idp-info.go index 83e3007d..1a22dd44 100644 --- a/cmd/admin-idp-info.go +++ b/cmd/admin-idp-info.go @@ -58,7 +58,7 @@ EXAMPLES: func mainAdminIDPGet(ctx *cli.Context) error { if len(ctx.Args()) < 2 || len(ctx.Args()) > 3 { - showCommandHelpAndExit(ctx, "get", 1) + showCommandHelpAndExit(ctx, 1) } args := ctx.Args() diff --git a/cmd/admin-idp-ls.go b/cmd/admin-idp-ls.go index 31c9cb04..c821602d 100644 --- a/cmd/admin-idp-ls.go +++ b/cmd/admin-idp-ls.go @@ -53,7 +53,7 @@ EXAMPLES: func mainAdminIDPList(ctx *cli.Context) error { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "ls", 1) + showCommandHelpAndExit(ctx, 1) } args := ctx.Args() diff --git a/cmd/admin-idp-rm.go b/cmd/admin-idp-rm.go index eddab39c..30b6e353 100644 --- a/cmd/admin-idp-rm.go +++ b/cmd/admin-idp-rm.go @@ -48,7 +48,7 @@ EXAMPLES: func mainAdminIDPRemove(ctx *cli.Context) error { if len(ctx.Args()) != 3 { - showCommandHelpAndExit(ctx, "rm", 1) + showCommandHelpAndExit(ctx, 1) } args := ctx.Args() diff --git a/cmd/admin-idp-set.go b/cmd/admin-idp-set.go index 998bf3d6..1f9b56ae 100644 --- a/cmd/admin-idp-set.go +++ b/cmd/admin-idp-set.go @@ -84,7 +84,7 @@ func validateIDType(idpType string) { func mainAdminIDPSet(ctx *cli.Context) error { if len(ctx.Args()) < 3 { - showCommandHelpAndExit(ctx, "set", 1) + showCommandHelpAndExit(ctx, 1) } args := ctx.Args() diff --git a/cmd/admin-info.go b/cmd/admin-info.go index dc9bc7f5..98dafc44 100644 --- a/cmd/admin-info.go +++ b/cmd/admin-info.go @@ -322,7 +322,7 @@ func (u clusterStruct) JSON() string { // checkAdminInfoSyntax - validate arguments passed by a user func checkAdminInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-kms-key-create.go b/cmd/admin-kms-key-create.go index a43af205..4ccefb26 100644 --- a/cmd/admin-kms-key-create.go +++ b/cmd/admin-kms-key-create.go @@ -53,7 +53,7 @@ EXAMPLES: // adminKMSCreateKeyCmd is the handler for the "mc admin kms key create" command. func mainAdminKMSCreateKey(ctx *cli.Context) error { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "create", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } client, err := newAdminClient(ctx.Args().Get(0)) diff --git a/cmd/admin-kms-key-status.go b/cmd/admin-kms-key-status.go index 9db7981c..0afcca98 100644 --- a/cmd/admin-kms-key-status.go +++ b/cmd/admin-kms-key-status.go @@ -54,7 +54,7 @@ EXAMPLES: // adminKMSKeyCmd is the handle for the "mc admin kms key" command. func mainAdminKMSKeyStatus(ctx *cli.Context) error { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { - showCommandHelpAndExit(ctx, "status", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } console.SetColor("StatusSuccess", color.New(color.FgGreen, color.Bold)) diff --git a/cmd/admin-policy-add.go b/cmd/admin-policy-add.go index 803a4f44..8cb9502d 100644 --- a/cmd/admin-policy-add.go +++ b/cmd/admin-policy-add.go @@ -60,7 +60,7 @@ EXAMPLES: // checkAdminPolicyAddSyntax - validate all the passed arguments func checkAdminPolicyAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { - showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-info.go b/cmd/admin-policy-info.go index 1800f7e8..0e08206c 100644 --- a/cmd/admin-policy-info.go +++ b/cmd/admin-policy-info.go @@ -65,7 +65,7 @@ EXAMPLES: // checkAdminPolicyInfoSyntax - validate all the passed arguments func checkAdminPolicyInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-list.go b/cmd/admin-policy-list.go index 8c10bf18..48f67754 100644 --- a/cmd/admin-policy-list.go +++ b/cmd/admin-policy-list.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminPolicyListSyntax - validate all the passed arguments func checkAdminPolicyListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-remove.go b/cmd/admin-policy-remove.go index 0eb2ad74..2019c372 100644 --- a/cmd/admin-policy-remove.go +++ b/cmd/admin-policy-remove.go @@ -52,7 +52,7 @@ EXAMPLES: // checkAdminPolicyRemoveSyntax - validate all the passed arguments func checkAdminPolicyRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-set.go b/cmd/admin-policy-set.go index bf7e9890..553af681 100644 --- a/cmd/admin-policy-set.go +++ b/cmd/admin-policy-set.go @@ -62,7 +62,7 @@ var errBadUserGroupArg = errors.New("Last argument must be of the form user=xx o func checkAdminPolicySetSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { - showCommandHelpAndExit(ctx, "set", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-unset.go b/cmd/admin-policy-unset.go index f413053d..fc6ef9cb 100644 --- a/cmd/admin-policy-unset.go +++ b/cmd/admin-policy-unset.go @@ -58,7 +58,7 @@ EXAMPLES: func checkAdminPolicyUnsetSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { - showCommandHelpAndExit(ctx, "unset", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-policy-update.go b/cmd/admin-policy-update.go index 119e434e..8e06f150 100644 --- a/cmd/admin-policy-update.go +++ b/cmd/admin-policy-update.go @@ -58,7 +58,7 @@ EXAMPLES: func checkAdminPolicyUpdateSyntax(ctx *cli.Context) { if len(ctx.Args()) != 3 { - showCommandHelpAndExit(ctx, "update", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-prometheus-generate.go b/cmd/admin-prometheus-generate.go index ff363ce1..2ca82892 100644 --- a/cmd/admin-prometheus-generate.go +++ b/cmd/admin-prometheus-generate.go @@ -139,7 +139,7 @@ var defaultConfig = PrometheusConfig{ // checkAdminPrometheusSyntax - validate all the passed arguments func checkAdminPrometheusSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "generate", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-prometheus-metrics.go b/cmd/admin-prometheus-metrics.go index e3a61bdf..961ecbf9 100644 --- a/cmd/admin-prometheus-metrics.go +++ b/cmd/admin-prometheus-metrics.go @@ -58,7 +58,7 @@ const ( // checkSupportMetricsSyntax - validate arguments passed by a user func checkSupportMetricsSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "metrics", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-rebalance-start.go b/cmd/admin-rebalance-start.go index 3104e069..06fcf566 100644 --- a/cmd/admin-rebalance-start.go +++ b/cmd/admin-rebalance-start.go @@ -68,7 +68,7 @@ func (r rebalanceStartMsg) String() string { func mainAdminRebalanceStart(ctx *cli.Context) error { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } console.SetColor("rebalanceStartMsg", color.New(color.FgGreen)) diff --git a/cmd/admin-rebalance-status.go b/cmd/admin-rebalance-status.go index 4c50e10a..0f245da9 100644 --- a/cmd/admin-rebalance-status.go +++ b/cmd/admin-rebalance-status.go @@ -54,7 +54,7 @@ EXAMPLES: func mainAdminRebalanceStatus(ctx *cli.Context) error { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } args := ctx.Args() diff --git a/cmd/admin-rebalance-stop.go b/cmd/admin-rebalance-stop.go index a4ac542e..841827a1 100644 --- a/cmd/admin-rebalance-stop.go +++ b/cmd/admin-rebalance-stop.go @@ -67,7 +67,7 @@ func (r rebalanceStopMsg) String() string { func mainAdminRebalanceStop(ctx *cli.Context) error { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } console.SetColor("rebalanceStopMsg", color.New(color.FgGreen)) diff --git a/cmd/admin-replicate-edit.go b/cmd/admin-replicate-edit.go index 8f4e5cdc..825714a8 100644 --- a/cmd/admin-replicate-edit.go +++ b/cmd/admin-replicate-edit.go @@ -85,7 +85,7 @@ func checkAdminReplicateEditSyntax(ctx *cli.Context) { // Check argument count argsNr := len(ctx.Args()) if argsNr < 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr != 1 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-scanner-status.go b/cmd/admin-scanner-status.go index c5b7a5df..aadae04b 100644 --- a/cmd/admin-scanner-status.go +++ b/cmd/admin-scanner-status.go @@ -87,7 +87,7 @@ EXAMPLES: // checkAdminTopAPISyntax - validate all the passed arguments func checkAdminScannerInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-scanner-trace.go b/cmd/admin-scanner-trace.go index c9429987..8a35a35e 100644 --- a/cmd/admin-scanner-trace.go +++ b/cmd/admin-scanner-trace.go @@ -85,7 +85,7 @@ EXAMPLES: func checkAdminScannerTraceSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-service-freeze.go b/cmd/admin-service-freeze.go index a5e329e5..d31fd6da 100644 --- a/cmd/admin-service-freeze.go +++ b/cmd/admin-service-freeze.go @@ -70,7 +70,7 @@ func (s serviceFreezeCommand) JSON() string { // checkAdminServiceFreezeSyntax - validate all the passed arguments func checkAdminServiceFreezeSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "freeze", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-service-restart.go b/cmd/admin-service-restart.go index 42348264..fb33cfc9 100644 --- a/cmd/admin-service-restart.go +++ b/cmd/admin-service-restart.go @@ -98,7 +98,7 @@ func (s serviceRestartMessage) JSON() string { // checkAdminServiceRestartSyntax - validate all the passed arguments func checkAdminServiceRestartSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "restart", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-service-stop.go b/cmd/admin-service-stop.go index 5d97eb78..065cf45d 100644 --- a/cmd/admin-service-stop.go +++ b/cmd/admin-service-stop.go @@ -69,7 +69,7 @@ func (s serviceStopMessage) JSON() string { // checkAdminServiceStopSyntax - validate all the passed arguments func checkAdminServiceStopSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { - showCommandHelpAndExit(ctx, "stop", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-service-unfreeze.go b/cmd/admin-service-unfreeze.go index f997760f..c49aeecd 100644 --- a/cmd/admin-service-unfreeze.go +++ b/cmd/admin-service-unfreeze.go @@ -69,7 +69,7 @@ func (s serviceUnfreezeCommand) JSON() string { // checkAdminServiceUnfreezeSyntax - validate all the passed arguments func checkAdminServiceUnfreezeSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "unfreeze", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-tier-add.go b/cmd/admin-tier-add.go index a8fd8a68..64f109b0 100644 --- a/cmd/admin-tier-add.go +++ b/cmd/admin-tier-add.go @@ -133,7 +133,7 @@ EXAMPLES: func checkAdminTierAddSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr < 3 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 3 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-tier-edit.go b/cmd/admin-tier-edit.go index 03285f10..fc05cb3f 100644 --- a/cmd/admin-tier-edit.go +++ b/cmd/admin-tier-edit.go @@ -89,7 +89,7 @@ EXAMPLES: func checkAdminTierEditSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr < 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 2 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-tier-info.go b/cmd/admin-tier-info.go index c6d1ff7f..550041e0 100644 --- a/cmd/admin-tier-info.go +++ b/cmd/admin-tier-info.go @@ -61,7 +61,7 @@ EXAMPLES: func checkAdminTierInfoSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr < 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 2 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-tier-ls.go b/cmd/admin-tier-ls.go index 08bfb484..60254a96 100644 --- a/cmd/admin-tier-ls.go +++ b/cmd/admin-tier-ls.go @@ -53,7 +53,7 @@ EXAMPLES: func checkAdminTierListSyntax(ctx *cli.Context) { argsNr := len(ctx.Args()) if argsNr < 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 1 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/admin-tier-rm.go b/cmd/admin-tier-rm.go index 585f1138..6101601c 100644 --- a/cmd/admin-tier-rm.go +++ b/cmd/admin-tier-rm.go @@ -51,7 +51,7 @@ func mainAdminTierRm(ctx *cli.Context) error { args := ctx.Args() nArgs := len(args) if nArgs < 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } if nArgs != 2 { fatalIf(errInvalidArgument().Trace(args.Tail()...), diff --git a/cmd/admin-tier-verify.go b/cmd/admin-tier-verify.go index 4258df59..4154d8e6 100644 --- a/cmd/admin-tier-verify.go +++ b/cmd/admin-tier-verify.go @@ -51,7 +51,7 @@ func mainAdminTierVerify(ctx *cli.Context) error { args := ctx.Args() nArgs := len(args) if nArgs < 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } if nArgs != 2 { fatalIf(errInvalidArgument().Trace(args.Tail()...), diff --git a/cmd/admin-trace.go b/cmd/admin-trace.go index 5dddf876..06c853ce 100644 --- a/cmd/admin-trace.go +++ b/cmd/admin-trace.go @@ -124,7 +124,7 @@ var colors = []color.Attribute{color.FgCyan, color.FgWhite, color.FgYellow, colo func checkAdminTraceSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "trace", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-update.go b/cmd/admin-update.go index adede3d0..3fe2f643 100644 --- a/cmd/admin-update.go +++ b/cmd/admin-update.go @@ -83,7 +83,7 @@ func (s serverUpdateMessage) JSON() string { // checkAdminServerUpdateSyntax - validate all the passed arguments func checkAdminServerUpdateSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { - showCommandHelpAndExit(ctx, "update", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-disable.go b/cmd/admin-user-disable.go index 144ea0db..f22d18da 100644 --- a/cmd/admin-user-disable.go +++ b/cmd/admin-user-disable.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminUserDisableSyntax - validate all the passed arguments func checkAdminUserDisableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "disable", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-enable.go b/cmd/admin-user-enable.go index e1b8d310..864ff9cb 100644 --- a/cmd/admin-user-enable.go +++ b/cmd/admin-user-enable.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminUserEnableSyntax - validate all the passed arguments func checkAdminUserEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-info.go b/cmd/admin-user-info.go index 87c29411..8e72e1f3 100644 --- a/cmd/admin-user-info.go +++ b/cmd/admin-user-info.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminUserAddSyntax - validate all the passed arguments func checkAdminUserInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-list.go b/cmd/admin-user-list.go index 94ab099f..3d513bae 100644 --- a/cmd/admin-user-list.go +++ b/cmd/admin-user-list.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminUserListSyntax - validate all the passed arguments func checkAdminUserListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-policy.go b/cmd/admin-user-policy.go index 42b3d314..b9d64324 100644 --- a/cmd/admin-user-policy.go +++ b/cmd/admin-user-policy.go @@ -52,7 +52,7 @@ EXAMPLES: // checkAdminUserPolicySyntax - validate all the passed arguments func checkAdminUserPolicySyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "policy", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-remove.go b/cmd/admin-user-remove.go index b5199c0d..1366fc09 100644 --- a/cmd/admin-user-remove.go +++ b/cmd/admin-user-remove.go @@ -49,7 +49,7 @@ EXAMPLES: // checkAdminUserRemoveSyntax - validate all the passed arguments func checkAdminUserRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/admin-user-svcacct-add.go b/cmd/admin-user-svcacct-add.go index de26359e..5b0b226f 100644 --- a/cmd/admin-user-svcacct-add.go +++ b/cmd/admin-user-svcacct-add.go @@ -75,7 +75,7 @@ EXAMPLES: // checkAdminUserSvcAcctAddSyntax - validate all the passed arguments func checkAdminUserSvcAcctAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "add", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-disable.go b/cmd/admin-user-svcacct-disable.go index 5c1afa44..7b5a5045 100644 --- a/cmd/admin-user-svcacct-disable.go +++ b/cmd/admin-user-svcacct-disable.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminUserSvcAcctDisableSyntax - validate all the passed arguments func checkAdminUserSvcAcctDisableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "disable", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-enable.go b/cmd/admin-user-svcacct-enable.go index 30b83382..a9078dd3 100644 --- a/cmd/admin-user-svcacct-enable.go +++ b/cmd/admin-user-svcacct-enable.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminUserSvcAcctEnableSyntax - validate all the passed arguments func checkAdminUserSvcAcctEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "enable", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-info.go b/cmd/admin-user-svcacct-info.go index dcf0ec46..76d7f4d6 100644 --- a/cmd/admin-user-svcacct-info.go +++ b/cmd/admin-user-svcacct-info.go @@ -61,7 +61,7 @@ EXAMPLES: // checkAdminUserSvcAcctInfoSyntax - validate all the passed arguments func checkAdminUserSvcAcctInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "info", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-list.go b/cmd/admin-user-svcacct-list.go index 2c7e96e8..398e086f 100644 --- a/cmd/admin-user-svcacct-list.go +++ b/cmd/admin-user-svcacct-list.go @@ -53,7 +53,7 @@ EXAMPLES: // checkAdminUserSvcAcctListSyntax - validate all the passed arguments func checkAdminUserSvcAcctListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "ls", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-rm.go b/cmd/admin-user-svcacct-rm.go index 4b531efd..19522168 100644 --- a/cmd/admin-user-svcacct-rm.go +++ b/cmd/admin-user-svcacct-rm.go @@ -50,7 +50,7 @@ EXAMPLES: // checkAdminUserSvcAcctRemoveSyntax - validate all the passed arguments func checkAdminUserSvcAcctRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "rm", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/admin-user-svcacct-set.go b/cmd/admin-user-svcacct-set.go index 70f83db0..1cb92076 100644 --- a/cmd/admin-user-svcacct-set.go +++ b/cmd/admin-user-svcacct-set.go @@ -62,7 +62,7 @@ EXAMPLES: // checkAdminUserSvcAcctSetSyntax - validate all the passed arguments func checkAdminUserSvcAcctSetSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "edit", 1) + showCommandHelpAndExit(ctx, 1) } } diff --git a/cmd/alias-import.go b/cmd/alias-import.go index cfb5c2a3..36618887 100644 --- a/cmd/alias-import.go +++ b/cmd/alias-import.go @@ -70,7 +70,7 @@ func checkAliasImportSyntax(ctx *cli.Context) { argsNr := len(args) if argsNr == 0 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) + showCommandHelpAndExit(ctx, 1) } if argsNr > 2 { fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), diff --git a/cmd/alias-set.go b/cmd/alias-set.go index 105039ed..bf478d0a 100644 --- a/cmd/alias-set.go +++ b/cmd/alias-set.go @@ -106,7 +106,7 @@ func checkAliasSetSyntax(ctx *cli.Context, accessKey string, secretKey string, d argsNr := len(args) if argsNr == 0 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if argsNr > 4 || argsNr < 2 { diff --git a/cmd/anonymous-main.go b/cmd/anonymous-main.go index da1d4234..9ad9c361 100644 --- a/cmd/anonymous-main.go +++ b/cmd/anonymous-main.go @@ -178,11 +178,11 @@ func checkAnonymousSyntax(ctx *cli.Context) { argsLength := len(ctx.Args()) // Always print a help message when we have extra arguments if argsLength > 3 { - showCommandHelpAndExit(ctx, "anonymous", 1) // last argument is exit code. + showCommandHelpAndExit(ctx, 1) // last argument is exit code. } // Always print a help message when no arguments specified if argsLength < 1 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } firstArg := ctx.Args().Get(0) @@ -193,7 +193,7 @@ func checkAnonymousSyntax(ctx *cli.Context) { case "set": // Always expect three arguments when setting a anonymous permission. if argsLength != 3 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } if accessPerms(secondArg) != accessNone && accessPerms(secondArg) != accessDownload && @@ -207,25 +207,25 @@ func checkAnonymousSyntax(ctx *cli.Context) { case "set-json": // Always expect three arguments when setting a anonymous permission. if argsLength != 3 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } case "get", "get-json": // get or get-json always expects two arguments if argsLength != 2 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } case "list": // Always expect an argument after list cmd if argsLength != 2 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } case "links": // Always expect an argument after links cmd if argsLength != 2 { - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } default: - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } } @@ -493,7 +493,7 @@ func mainAnonymous(ctx *cli.Context) error { runAnonymousLinksCmd(ctx.Args().Tail(), ctx.Bool("recursive")) default: // Shows command example and exit - showCommandHelpAndExit(ctx, "anonymous", 1) + showCommandHelpAndExit(ctx, 1) } return nil } diff --git a/cmd/batch-describe.go b/cmd/batch-describe.go index 766f858f..3c72d693 100644 --- a/cmd/batch-describe.go +++ b/cmd/batch-describe.go @@ -50,7 +50,7 @@ EXAMPLES: // checkBatchDescribeSyntax - validate all the passed arguments func checkBatchDescribeSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/batch-generate.go b/cmd/batch-generate.go index 43a71a82..f46cd071 100644 --- a/cmd/batch-generate.go +++ b/cmd/batch-generate.go @@ -63,7 +63,7 @@ func supportedJobTypes() string { // checkBatchGenerateSyntax - validate all the passed arguments func checkBatchGenerateSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/batch-list.go b/cmd/batch-list.go index ec664ec2..12b29fdc 100644 --- a/cmd/batch-list.go +++ b/cmd/batch-list.go @@ -120,7 +120,7 @@ func (c batchListMessage) JSON() string { // checkBatchListSyntax - validate all the passed arguments func checkBatchListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/batch-start.go b/cmd/batch-start.go index 728428ba..0dd5e2d5 100644 --- a/cmd/batch-start.go +++ b/cmd/batch-start.go @@ -75,7 +75,7 @@ func (c batchStartMessage) JSON() string { // checkBatchStartSyntax - validate all the passed arguments func checkBatchStartSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/batch-status.go b/cmd/batch-status.go index 43cfb0da..afd66cfc 100644 --- a/cmd/batch-status.go +++ b/cmd/batch-status.go @@ -44,7 +44,7 @@ EXAMPLES: // checkBatchStatusSyntax - validate all the passed arguments func checkBatchStatusSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/cp-url-syntax.go b/cmd/cp-url-syntax.go index baa4565e..f2df0683 100644 --- a/cmd/cp-url-syntax.go +++ b/cmd/cp-url-syntax.go @@ -31,9 +31,9 @@ import ( func checkCopySyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) { if len(cliCtx.Args()) < 2 { if isMvCmd { - showCommandHelpAndExit(cliCtx, "mv", 1) // last argument is exit code. + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code. } - showCommandHelpAndExit(cliCtx, "cp", 1) // last argument is exit code. + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code. } // extract URLs. diff --git a/cmd/diff-main.go b/cmd/diff-main.go index fceea18d..8028d6ab 100644 --- a/cmd/diff-main.go +++ b/cmd/diff-main.go @@ -116,7 +116,7 @@ func (d diffMessage) JSON() string { func checkDiffSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) { if len(cliCtx.Args()) != 2 { - showCommandHelpAndExit(cliCtx, "diff", 1) // last argument is exit code + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code } for _, arg := range cliCtx.Args() { if strings.TrimSpace(arg) == "" { diff --git a/cmd/du-main.go b/cmd/du-main.go index a0bfbb15..303f334d 100644 --- a/cmd/du-main.go +++ b/cmd/du-main.go @@ -206,7 +206,7 @@ func du(ctx context.Context, urlStr string, timeRef time.Time, withVersions bool // main for du command. func mainDu(cliCtx *cli.Context) error { if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "du", 1) + showCommandHelpAndExit(cliCtx, 1) } // Set colors. diff --git a/cmd/encrypt-clear.go b/cmd/encrypt-clear.go index 1eec8dc4..aa1b4ac2 100644 --- a/cmd/encrypt-clear.go +++ b/cmd/encrypt-clear.go @@ -53,7 +53,7 @@ EXAMPLES: // checkEncryptClearSyntax - validate all the passed arguments func checkEncryptClearSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "clear", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/encrypt-info.go b/cmd/encrypt-info.go index db58c1a6..4b6b898c 100644 --- a/cmd/encrypt-info.go +++ b/cmd/encrypt-info.go @@ -53,7 +53,7 @@ EXAMPLES: // checkversionInfoSyntax - validate all the passed arguments func checkEncryptInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/encrypt-set.go b/cmd/encrypt-set.go index 1b6a6b17..0a242577 100644 --- a/cmd/encrypt-set.go +++ b/cmd/encrypt-set.go @@ -57,7 +57,7 @@ EXAMPLES: // checkEncryptSetSyntax - validate all the passed arguments func checkEncryptSetSyntax(ctx *cli.Context) { if len(ctx.Args()) < 2 || len(ctx.Args()) > 3 { - showCommandHelpAndExit(ctx, "set", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/event-add.go b/cmd/event-add.go index 503d4d82..48cc04ae 100644 --- a/cmd/event-add.go +++ b/cmd/event-add.go @@ -82,7 +82,7 @@ EXAMPLES: // checkEventAddSyntax - validate all the passed arguments func checkEventAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/event-list.go b/cmd/event-list.go index b4b7339f..63c704d1 100644 --- a/cmd/event-list.go +++ b/cmd/event-list.go @@ -58,7 +58,7 @@ EXAMPLES: // checkEventListSyntax - validate all the passed arguments func checkEventListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 && len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/event-remove.go b/cmd/event-remove.go index 2b6cfa63..721ea046 100644 --- a/cmd/event-remove.go +++ b/cmd/event-remove.go @@ -76,7 +76,7 @@ EXAMPLES: // checkEventRemoveSyntax - validate all the passed arguments func checkEventRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { - showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if len(ctx.Args()) == 1 && !ctx.Bool("force") { fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications.") diff --git a/cmd/ilm-add.go b/cmd/ilm-add.go index bc441997..0c2f0eba 100644 --- a/cmd/ilm-add.go +++ b/cmd/ilm-add.go @@ -156,7 +156,7 @@ func (i ilmAddMessage) JSON() string { // Validate user given arguments func checkILMAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "add", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } } diff --git a/cmd/ilm-edit.go b/cmd/ilm-edit.go index 68ae961f..85fd1459 100644 --- a/cmd/ilm-edit.go +++ b/cmd/ilm-edit.go @@ -100,7 +100,7 @@ func (i ilmEditMessage) JSON() string { // Validate user given arguments func checkILMEditSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "edit", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } id := ctx.String("id") if id == "" { diff --git a/cmd/ilm-export.go b/cmd/ilm-export.go index 65d55d94..89f6bd01 100644 --- a/cmd/ilm-export.go +++ b/cmd/ilm-export.go @@ -75,7 +75,7 @@ func (i ilmExportMessage) JSON() string { // checkILMExportSyntax - validate arguments passed by user func checkILMExportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "export", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } } diff --git a/cmd/ilm-import.go b/cmd/ilm-import.go index 21c0cb68..ead1886a 100644 --- a/cmd/ilm-import.go +++ b/cmd/ilm-import.go @@ -85,7 +85,7 @@ func readILMConfig() (*lifecycle.Configuration, *probe.Error) { // checkILMImportSyntax - validate arguments passed by user func checkILMImportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "import", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } } diff --git a/cmd/ilm-ls.go b/cmd/ilm-ls.go index 085532dd..65c0470c 100644 --- a/cmd/ilm-ls.go +++ b/cmd/ilm-ls.go @@ -166,7 +166,7 @@ func validateILMListFlagSet(ctx *cli.Context) bool { // checkILMListSyntax - validate arguments passed by a user func checkILMListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "ls", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } if !validateILMListFlagSet(ctx) { diff --git a/cmd/ilm-restore.go b/cmd/ilm-restore.go index 8c9fcf8c..7a4c0a50 100644 --- a/cmd/ilm-restore.go +++ b/cmd/ilm-restore.go @@ -91,7 +91,7 @@ EXAMPLES: // checkILMRestoreSyntax - validate arguments passed by user func checkILMRestoreSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "restore", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } if ctx.Int("days") <= 0 { diff --git a/cmd/ilm-rm.go b/cmd/ilm-rm.go index 4b8b4041..cde7ae70 100644 --- a/cmd/ilm-rm.go +++ b/cmd/ilm-rm.go @@ -95,7 +95,7 @@ func (i ilmRmMessage) JSON() string { func checkILMRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "rm", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } ilmAll := ctx.Bool("all") diff --git a/cmd/legalhold-set.go b/cmd/legalhold-set.go index 22e6f6f4..523006c9 100644 --- a/cmd/legalhold-set.go +++ b/cmd/legalhold-set.go @@ -173,7 +173,7 @@ func setLegalHold(ctx context.Context, urlStr, versionID string, timeRef time.Ti func parseLegalHoldArgs(cliCtx *cli.Context) (targetURL, versionID string, timeRef time.Time, recursive, withVersions bool) { args := cliCtx.Args() if len(args) != 1 { - showCommandHelpAndExit(cliCtx, cliCtx.Command.Name, 1) + showCommandHelpAndExit(cliCtx, 1) } targetURL = args[0] diff --git a/cmd/license-info.go b/cmd/license-info.go index b879ec90..2c7d4000 100644 --- a/cmd/license-info.go +++ b/cmd/license-info.go @@ -173,7 +173,7 @@ func initLicInfoColors() { func mainLicenseInfo(ctx *cli.Context) error { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } initLicInfoColors() diff --git a/cmd/license-register.go b/cmd/license-register.go index a16c146a..08b832ff 100644 --- a/cmd/license-register.go +++ b/cmd/license-register.go @@ -105,7 +105,7 @@ func (li licRegisterMessage) JSON() string { // checkLicenseRegisterSyntax - validate arguments passed by a user func checkLicenseRegisterSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "register", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/license-unregister.go b/cmd/license-unregister.go index 4eedfc5a..413a3c98 100644 --- a/cmd/license-unregister.go +++ b/cmd/license-unregister.go @@ -74,7 +74,7 @@ func (li licUnregisterMessage) JSON() string { // checkLicenseUnregisterSyntax - validate arguments passed by a user func checkLicenseUnregisterSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "unregister", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/license-update.go b/cmd/license-update.go index b61aa09c..007abbc4 100644 --- a/cmd/license-update.go +++ b/cmd/license-update.go @@ -74,7 +74,7 @@ func (li licUpdateMessage) JSON() string { func mainLicenseUpdate(ctx *cli.Context) error { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, "update", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } console.SetColor(licUpdateMsgTag, color.New(color.FgGreen, color.Bold)) diff --git a/cmd/main.go b/cmd/main.go index 0e9b31da..8f571860 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -520,8 +520,8 @@ func mustGetProfileDir() string { return filepath.Join(mustGetMcConfigDir(), globalProfileDir) } -func showCommandHelpAndExit(cliCtx *cli.Context, cmd string, code int) { - cli.ShowCommandHelp(cliCtx, cmd) +func showCommandHelpAndExit(cliCtx *cli.Context, code int) { + cli.ShowCommandHelp(cliCtx, cliCtx.Command.Name) // Wait until the user quits the pager globalHelpPager.WaitForExit() os.Exit(code) diff --git a/cmd/mb-main.go b/cmd/mb-main.go index dfb7b155..dda8f3ab 100644 --- a/cmd/mb-main.go +++ b/cmd/mb-main.go @@ -114,7 +114,7 @@ func (s makeBucketMessage) JSON() string { // Validate command line arguments. func checkMakeBucketSyntax(cliCtx *cli.Context) { if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "mb", 1) // last argument is exit code + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code } } diff --git a/cmd/mirror-url.go b/cmd/mirror-url.go index 8ca1a26e..7a45eac9 100644 --- a/cmd/mirror-url.go +++ b/cmd/mirror-url.go @@ -37,7 +37,7 @@ import ( // checkMirrorSyntax(URLs []string) func checkMirrorSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) (srcURL, tgtURL string) { if len(cliCtx.Args()) != 2 { - showCommandHelpAndExit(cliCtx, "mirror", 1) // last argument is exit code. + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code. } // extract URLs. diff --git a/cmd/od-main.go b/cmd/od-main.go index bf6fdfbf..a8ddef0d 100644 --- a/cmd/od-main.go +++ b/cmd/od-main.go @@ -163,7 +163,7 @@ func mainOD(cliCtx *cli.Context) error { defer cancelCopy() if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "od", 1) // last argument is exit code + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code } var kvsArgs argKVS diff --git a/cmd/ping.go b/cmd/ping.go index 83a7c421..aa9fb2a4 100644 --- a/cmd/ping.go +++ b/cmd/ping.go @@ -96,7 +96,7 @@ var stop bool // Validate command line arguments. func checkPingSyntax(cliCtx *cli.Context) { if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "ping", 1) // last argument is exit code + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code } } diff --git a/cmd/pipe-main.go b/cmd/pipe-main.go index d6af97cd..781453c1 100644 --- a/cmd/pipe-main.go +++ b/cmd/pipe-main.go @@ -120,7 +120,7 @@ func pipe(targetURL string, encKeyDB map[string][]prefixSSEPair, storageClass st // check pipe input arguments. func checkPipeSyntax(ctx *cli.Context) { if len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "pipe", 1) // last argument is exit code. + showCommandHelpAndExit(ctx, 1) // last argument is exit code. } } diff --git a/cmd/rb-main.go b/cmd/rb-main.go index ebf8215f..51f0f57c 100644 --- a/cmd/rb-main.go +++ b/cmd/rb-main.go @@ -98,7 +98,7 @@ func (s removeBucketMessage) JSON() string { func checkRbSyntax(ctx context.Context, cliCtx *cli.Context) { if !cliCtx.Args().Present() { exitCode := 1 - showCommandHelpAndExit(cliCtx, "rb", exitCode) + showCommandHelpAndExit(cliCtx, exitCode) } // Set command flags from context. isForce := cliCtx.Bool("force") diff --git a/cmd/ready.go b/cmd/ready.go index 121c7fcb..ae3a1aa8 100644 --- a/cmd/ready.go +++ b/cmd/ready.go @@ -97,7 +97,7 @@ func (r readyMessage) JSON() string { func mainReady(cliCtx *cli.Context) error { if !cliCtx.Args().Present() { exitCode := 1 - showCommandHelpAndExit(cliCtx, "ready", exitCode) + showCommandHelpAndExit(cliCtx, exitCode) } // Set command flags from context. diff --git a/cmd/replicate-add.go b/cmd/replicate-add.go index 614e606b..fea4e98d 100644 --- a/cmd/replicate-add.go +++ b/cmd/replicate-add.go @@ -110,7 +110,7 @@ EXAMPLES: // checkReplicateAddSyntax - validate all the passed arguments func checkReplicateAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if ctx.String("remote-bucket") == "" { fatal(errDummy().Trace(), "--remote-bucket flag needs to be specified.") diff --git a/cmd/replicate-diff.go b/cmd/replicate-diff.go index 6f468558..76660c66 100644 --- a/cmd/replicate-diff.go +++ b/cmd/replicate-diff.go @@ -68,7 +68,7 @@ EXAMPLES: // checkReplicateDiffSyntax - validate all the passed arguments func checkReplicateDiffSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "diff", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-edit.go b/cmd/replicate-edit.go index 8bd859ce..62586412 100644 --- a/cmd/replicate-edit.go +++ b/cmd/replicate-edit.go @@ -105,7 +105,7 @@ EXAMPLES: // checkReplicateEditSyntax - validate all the passed arguments func checkReplicateEditSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "edit", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-export.go b/cmd/replicate-export.go index 1837527c..cc99acd9 100644 --- a/cmd/replicate-export.go +++ b/cmd/replicate-export.go @@ -56,7 +56,7 @@ EXAMPLES: // checkReplicateExportSyntax - validate all the passed arguments func checkReplicateExportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-import.go b/cmd/replicate-import.go index b3b2724a..29de3311 100644 --- a/cmd/replicate-import.go +++ b/cmd/replicate-import.go @@ -57,7 +57,7 @@ EXAMPLES: // checkReplicateImportSyntax - validate all the passed arguments func checkReplicateImportSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-ls.go b/cmd/replicate-ls.go index e4d2e08c..556c675e 100644 --- a/cmd/replicate-ls.go +++ b/cmd/replicate-ls.go @@ -63,7 +63,7 @@ EXAMPLES: // checkReplicateListSyntax - validate all the passed arguments func checkReplicateListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "ls", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-reset-start.go b/cmd/replicate-reset-start.go index 5135280f..7a40e3a1 100644 --- a/cmd/replicate-reset-start.go +++ b/cmd/replicate-reset-start.go @@ -70,7 +70,7 @@ EXAMPLES: // checkReplicateResyncStartSyntax - validate all the passed arguments func checkReplicateResyncStartSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "start", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if ctx.String("remote-bucket") == "" { fatal(errDummy().Trace(), "--remote-bucket flag needs to be specified.") diff --git a/cmd/replicate-reset-status.go b/cmd/replicate-reset-status.go index 0376ddbe..841be360 100644 --- a/cmd/replicate-reset-status.go +++ b/cmd/replicate-reset-status.go @@ -65,7 +65,7 @@ EXAMPLES: // checkreplicateResyncStatusSyntax - validate all the passed arguments func checkreplicateResyncStatusSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "status", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/replicate-rm.go b/cmd/replicate-rm.go index 37d58d6f..0094635a 100644 --- a/cmd/replicate-rm.go +++ b/cmd/replicate-rm.go @@ -72,7 +72,7 @@ EXAMPLES: // checkReplicateRemoveSyntax - validate all the passed arguments func checkReplicateRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "rm", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } rmAll := ctx.Bool("all") rmForce := ctx.Bool("force") diff --git a/cmd/replicate-status.go b/cmd/replicate-status.go index a4df3552..4939a52b 100644 --- a/cmd/replicate-status.go +++ b/cmd/replicate-status.go @@ -56,7 +56,7 @@ EXAMPLES: // checkReplicateStatusSyntax - validate all the passed arguments func checkReplicateStatusSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "status", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/retention-clear.go b/cmd/retention-clear.go index 6d445a4e..0b4f5c24 100644 --- a/cmd/retention-clear.go +++ b/cmd/retention-clear.go @@ -92,7 +92,7 @@ func parseClearRetentionArgs(cliCtx *cli.Context) (target, versionID string, tim args := cliCtx.Args() if len(args) != 1 { - showCommandHelpAndExit(cliCtx, "clear", 1) + showCommandHelpAndExit(cliCtx, 1) } target = args[0] diff --git a/cmd/retention-info.go b/cmd/retention-info.go index 33495cd2..dbd0b6a5 100644 --- a/cmd/retention-info.go +++ b/cmd/retention-info.go @@ -93,7 +93,7 @@ func parseInfoRetentionArgs(cliCtx *cli.Context) (target, versionID string, recu args := cliCtx.Args() if len(args) != 1 { - showCommandHelpAndExit(cliCtx, "info", 1) + showCommandHelpAndExit(cliCtx, 1) } target = args[0] diff --git a/cmd/retention-set.go b/cmd/retention-set.go index ae7c8e8c..bb139b1b 100644 --- a/cmd/retention-set.go +++ b/cmd/retention-set.go @@ -96,7 +96,7 @@ EXAMPLES: func parseSetRetentionArgs(cliCtx *cli.Context) (target, versionID string, recursive bool, timeRef time.Time, withVersions bool, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, bypass, bucketMode bool) { args := cliCtx.Args() if len(args) != 3 { - showCommandHelpAndExit(cliCtx, "set", 1) + showCommandHelpAndExit(cliCtx, 1) } mode = minio.RetentionMode(strings.ToUpper(args[0])) diff --git a/cmd/rm-main.go b/cmd/rm-main.go index cde9a2ca..3bc3cdb5 100644 --- a/cmd/rm-main.go +++ b/cmd/rm-main.go @@ -257,7 +257,7 @@ func checkRmSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string } if !cliCtx.Args().Present() && !isStdin { exitCode := 1 - showCommandHelpAndExit(cliCtx, "rm", exitCode) + showCommandHelpAndExit(cliCtx, exitCode) } // For all recursive or versions bulk deletion operations make sure to check for 'force' flag. diff --git a/cmd/share-download-main.go b/cmd/share-download-main.go index 275639f1..efc090f7 100644 --- a/cmd/share-download-main.go +++ b/cmd/share-download-main.go @@ -74,7 +74,7 @@ EXAMPLES: func checkShareDownloadSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) { args := cliCtx.Args() if !args.Present() { - showCommandHelpAndExit(cliCtx, "download", 1) // last argument is exit code. + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code. } // Parse expiry. diff --git a/cmd/share-list-main.go b/cmd/share-list-main.go index 94c663b7..5f28b0f8 100644 --- a/cmd/share-list-main.go +++ b/cmd/share-list-main.go @@ -58,7 +58,7 @@ EXAMPLES: func checkShareListSyntax(ctx *cli.Context) { args := ctx.Args() if !args.Present() || (args.First() != "upload" && args.First() != "download") { - showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code. + showCommandHelpAndExit(ctx, 1) // last argument is exit code. } } diff --git a/cmd/share-upload-main.go b/cmd/share-upload-main.go index 99f61f87..b9a9ae2d 100644 --- a/cmd/share-upload-main.go +++ b/cmd/share-upload-main.go @@ -79,7 +79,7 @@ func shellQuote(s string) string { func checkShareUploadSyntax(ctx *cli.Context) { args := ctx.Args() if !args.Present() { - showCommandHelpAndExit(ctx, "upload", 1) // last argument is exit code. + showCommandHelpAndExit(ctx, 1) // last argument is exit code. } // Set command flags from context. diff --git a/cmd/sql-main.go b/cmd/sql-main.go index 6cf088de..fb994a88 100644 --- a/cmd/sql-main.go +++ b/cmd/sql-main.go @@ -430,7 +430,7 @@ func getAndValidateArgs(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, u // check sql input arguments. func checkSQLSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 { - showCommandHelpAndExit(ctx, "sql", 1) // last argument is exit code. + showCommandHelpAndExit(ctx, 1) // last argument is exit code. } } diff --git a/cmd/stat-main.go b/cmd/stat-main.go index 3b0ae266..e0647539 100644 --- a/cmd/stat-main.go +++ b/cmd/stat-main.go @@ -97,7 +97,7 @@ EXAMPLES: // parseAndCheckStatSyntax - parse and validate all the passed arguments func parseAndCheckStatSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) ([]string, bool, string, time.Time, bool) { if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "stat", 1) // last argument is exit code + showCommandHelpAndExit(cliCtx, 1) // last argument is exit code } args := cliCtx.Args() diff --git a/cmd/support-diag.go b/cmd/support-diag.go index f6faf32d..275ee2f3 100644 --- a/cmd/support-diag.go +++ b/cmd/support-diag.go @@ -95,7 +95,7 @@ EXAMPLES: // checkSupportDiagSyntax - validate arguments passed by a user func checkSupportDiagSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "diag", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support-inspect.go b/cmd/support-inspect.go index 18095427..7ef6192c 100644 --- a/cmd/support-inspect.go +++ b/cmd/support-inspect.go @@ -103,7 +103,7 @@ func (t inspectMessage) JSON() string { func checkSupportInspectSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "inspect", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support-logs-show.go b/cmd/support-logs-show.go index 33fc5764..f0467a98 100644 --- a/cmd/support-logs-show.go +++ b/cmd/support-logs-show.go @@ -73,7 +73,7 @@ EXAMPLES: func checkLogsShowSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 3 { - showCommandHelpAndExit(ctx, "show", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support-logs.go b/cmd/support-logs.go index ac18a802..43d7ef60 100644 --- a/cmd/support-logs.go +++ b/cmd/support-logs.go @@ -90,7 +90,7 @@ func configureSubnetWebhook(alias string, enable bool) { func validateLogsToggleCmd(ctx *cli.Context, cmdName string) string { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, cmdName, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } alias, _ := url2Alias(ctx.Args().Get(0)) return alias diff --git a/cmd/support-perf.go b/cmd/support-perf.go index 56091d9b..19ca6f28 100644 --- a/cmd/support-perf.go +++ b/cmd/support-perf.go @@ -207,7 +207,7 @@ func mainSupportPerf(ctx *cli.Context) error { case 1: // cannot use alias by the name 'drive' or 'net' if args[0] == "drive" || args[0] == "net" || args[0] == "object" { - showCommandHelpAndExit(ctx, "perf", 1) + showCommandHelpAndExit(ctx, 1) } aliasedURL = args[0] @@ -215,7 +215,7 @@ func mainSupportPerf(ctx *cli.Context) error { perfType = args[0] aliasedURL = args[1] default: - showCommandHelpAndExit(ctx, "perf", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } // Main execution @@ -378,7 +378,7 @@ func runPerfTests(ctx *cli.Context, aliasedURL string, perfType string) []PerfTe case "net": mainAdminSpeedTestNetperf(ctx, aliasedURL, resultCh) default: - showCommandHelpAndExit(ctx, "perf", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if !globalJSON { diff --git a/cmd/support-profile.go b/cmd/support-profile.go index 72013f06..ccd59d91 100644 --- a/cmd/support-profile.go +++ b/cmd/support-profile.go @@ -102,7 +102,7 @@ func checkAdminProfileSyntax(ctx *cli.Context) { } } if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "profile", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } if ctx.Int("duration") < 10 { diff --git a/cmd/support-top-api.go b/cmd/support-top-api.go index 99a209f4..45fa9eef 100644 --- a/cmd/support-top-api.go +++ b/cmd/support-top-api.go @@ -74,7 +74,7 @@ EXAMPLES: // checkSupportTopAPISyntax - validate all the passed arguments func checkSupportTopAPISyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "api", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support-top-drive.go b/cmd/support-top-drive.go index e1e923f3..e4499eb1 100644 --- a/cmd/support-top-drive.go +++ b/cmd/support-top-drive.go @@ -62,7 +62,7 @@ EXAMPLES: // checkSupportTopDriveSyntax - validate all the passed arguments func checkSupportTopDriveSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support-top-locks.go b/cmd/support-top-locks.go index 03237c91..52fcb049 100644 --- a/cmd/support-top-locks.go +++ b/cmd/support-top-locks.go @@ -112,7 +112,7 @@ func (u lockMessage) JSON() string { // checkAdminTopLocksSyntax - validate all the passed arguments func checkSupportTopLocksSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, "locks", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/support.go b/cmd/support.go index 2ce74517..ec7edfc0 100644 --- a/cmd/support.go +++ b/cmd/support.go @@ -71,7 +71,7 @@ func validateToggleCmdArg(arg string) error { func checkToggleCmdSyntax(ctx *cli.Context, cmdName string) (string, string) { if len(ctx.Args()) != 2 { - showCommandHelpAndExit(ctx, cmdName, 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } arg := ctx.Args().Get(0) diff --git a/cmd/tag-list.go b/cmd/tag-list.go index 90ef501a..b68ea21c 100644 --- a/cmd/tag-list.go +++ b/cmd/tag-list.go @@ -135,7 +135,7 @@ func (t tagListMessage) String() string { // parseTagListSyntax performs command-line input validation for tag list command. func parseTagListSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withOlderVersions bool) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "list", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } targetURL = ctx.Args().Get(0) diff --git a/cmd/tag-remove.go b/cmd/tag-remove.go index 1ea9b7f0..8b611808 100644 --- a/cmd/tag-remove.go +++ b/cmd/tag-remove.go @@ -104,7 +104,7 @@ func (t tagRemoveMessage) JSON() string { func parseRemoveTagSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withVersions bool) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "remove", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } targetURL = ctx.Args().Get(0) diff --git a/cmd/tag-set.go b/cmd/tag-set.go index 39647b97..f7ce5b3c 100644 --- a/cmd/tag-set.go +++ b/cmd/tag-set.go @@ -103,7 +103,7 @@ func (t tagSetMessage) JSON() string { func parseSetTagSyntax(ctx *cli.Context) (targetURL, versionID string, timeRef time.Time, withVersions bool, tags string) { if len(ctx.Args()) != 2 || ctx.Args().Get(1) == "" { - showCommandHelpAndExit(ctx, "set", globalErrorExitStatus) + showCommandHelpAndExit(ctx, globalErrorExitStatus) } targetURL = ctx.Args().Get(0) diff --git a/cmd/undo-main.go b/cmd/undo-main.go index 44a3a712..6cc40d59 100644 --- a/cmd/undo-main.go +++ b/cmd/undo-main.go @@ -258,7 +258,7 @@ func checkIfBucketIsVersioned(ctx context.Context, aliasedURL string) (versioned func checkUndoSyntax(cliCtx *cli.Context) { if !cliCtx.Args().Present() { - showCommandHelpAndExit(cliCtx, "undo", 1) + showCommandHelpAndExit(cliCtx, 1) } } diff --git a/cmd/update-main.go b/cmd/update-main.go index fc6bc2b7..dd6b7edf 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -513,7 +513,7 @@ func (s updateMessage) JSON() string { func mainUpdate(ctx *cli.Context) { if len(ctx.Args()) > 1 { - showCommandHelpAndExit(ctx, ctx.Command.Name, -1) + showCommandHelpAndExit(ctx, -1) } globalQuiet = ctx.Bool("quiet") || ctx.GlobalBool("quiet") diff --git a/cmd/version-enable.go b/cmd/version-enable.go index 971bebcd..60a6e220 100644 --- a/cmd/version-enable.go +++ b/cmd/version-enable.go @@ -72,7 +72,7 @@ EXAMPLES: // checkVersionEnableSyntax - validate all the passed arguments func checkVersionEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/version-info.go b/cmd/version-info.go index fa267f5a..567f8c00 100644 --- a/cmd/version-info.go +++ b/cmd/version-info.go @@ -54,7 +54,7 @@ EXAMPLES: // checkVersionInfoSyntax - validate all the passed arguments func checkVersionInfoSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/version-suspend.go b/cmd/version-suspend.go index ed00bc95..b96bc9c4 100644 --- a/cmd/version-suspend.go +++ b/cmd/version-suspend.go @@ -53,7 +53,7 @@ EXAMPLES: // checkVersionSuspendSyntax - validate all the passed arguments func checkVersionSuspendSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "suspend", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } } diff --git a/cmd/watch-main.go b/cmd/watch-main.go index f73c1f07..51c8b9d7 100644 --- a/cmd/watch-main.go +++ b/cmd/watch-main.go @@ -92,7 +92,7 @@ EXAMPLES: // checkWatchSyntax - validate all the passed arguments func checkWatchSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - showCommandHelpAndExit(ctx, "watch", 1) // last argument is exit code + showCommandHelpAndExit(ctx, 1) // last argument is exit code } }