1
0
mirror of https://github.com/minio/mc.git synced 2025-11-10 13:42:32 +03:00

generalize input for ctx.Command.Name (#4338)

This commit is contained in:
Harshavardhana
2022-11-01 08:04:26 -07:00
committed by GitHub
parent 15e52fd862
commit cf7e0ae050
149 changed files with 163 additions and 163 deletions

View File

@@ -142,7 +142,7 @@ EXAMPLES:
// checkAdminBucketInfoSyntax - validate all the passed arguments // checkAdminBucketInfoSyntax - validate all the passed arguments
func checkAdminBucketInfoSyntax(ctx *cli.Context) { func checkAdminBucketInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -108,7 +108,7 @@ EXAMPLES:
// checkAdminBucketQuotaSyntax - validate all the passed arguments // checkAdminBucketQuotaSyntax - validate all the passed arguments
func checkAdminBucketQuotaSyntax(ctx *cli.Context) { func checkAdminBucketQuotaSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -114,7 +114,7 @@ EXAMPLES:
func checkAdminBucketRemoteAddSyntax(ctx *cli.Context) { func checkAdminBucketRemoteAddSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 2 { 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 { if argsNr > 2 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -140,10 +140,10 @@ func checkAdminBwInfoSyntax(ctx *cli.Context) {
u != "Bi" && u != "Bi" &&
u != "B" && u != "B" &&
u != "" { u != "" {
showCommandHelpAndExit(ctx, "bandwidth", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
if len(ctx.Args()) > 1 || len(ctx.Args()) == 0 { if len(ctx.Args()) > 1 || len(ctx.Args()) == 0 {
showCommandHelpAndExit(ctx, "bandwidth", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
} }

View File

@@ -109,7 +109,7 @@ EXAMPLES:
func checkAdminBucketRemoteEditSyntax(ctx *cli.Context) { func checkAdminBucketRemoteEditSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr > 2 || argsNr == 0 { 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") { if !ctx.IsSet("arn") {
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "--arn flag needs to be set") fatalIf(errInvalidArgument().Trace(ctx.Args()...), "--arn flag needs to be set")

View File

@@ -66,7 +66,7 @@ EXAMPLES:
// checkAdminBucketRemoteListSyntax - validate all the passed arguments // checkAdminBucketRemoteListSyntax - validate all the passed arguments
func checkAdminBucketRemoteListSyntax(ctx *cli.Context) { func checkAdminBucketRemoteListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -57,7 +57,7 @@ EXAMPLES:
// checkAdminBucketRemoteRemoveSyntax - validate all the passed arguments // checkAdminBucketRemoteRemoveSyntax - validate all the passed arguments
func checkAdminBucketRemoteRemoveSyntax(ctx *cli.Context) { func checkAdminBucketRemoteRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ EXAMPLES:
func checkBucketExportSyntax(ctx *cli.Context) { func checkBucketExportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -60,7 +60,7 @@ EXAMPLES:
func checkBucketImportSyntax(ctx *cli.Context) { func checkBucketImportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -57,7 +57,7 @@ EXAMPLES:
func checkIAMExportSyntax(ctx *cli.Context) { func checkIAMExportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "export", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -55,7 +55,7 @@ EXAMPLES:
func checkIAMImportSyntax(ctx *cli.Context) { func checkIAMImportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "import", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -97,7 +97,7 @@ func (u configExportMessage) JSON() string {
// checkAdminConfigExportSyntax - validate all the passed arguments // checkAdminConfigExportSyntax - validate all the passed arguments
func checkAdminConfigExportSyntax(ctx *cli.Context) { func checkAdminConfigExportSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -111,7 +111,7 @@ func (u configGetMessage) JSON() string {
// checkAdminConfigGetSyntax - validate all the passed arguments // checkAdminConfigGetSyntax - validate all the passed arguments
func checkAdminConfigGetSyntax(ctx *cli.Context) { func checkAdminConfigGetSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) < 1 { 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
} }
} }

View File

@@ -109,7 +109,7 @@ func (u configHistoryMessage) JSON() string {
// checkAdminConfigHistorySyntax - validate all the passed arguments // checkAdminConfigHistorySyntax - validate all the passed arguments
func checkAdminConfigHistorySyntax(ctx *cli.Context) { func checkAdminConfigHistorySyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -78,7 +78,7 @@ func (u configImportMessage) JSON() string {
// checkAdminConfigImportSyntax - validate all the passed arguments // checkAdminConfigImportSyntax - validate all the passed arguments
func checkAdminConfigImportSyntax(ctx *cli.Context) { func checkAdminConfigImportSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -92,7 +92,7 @@ func (u configResetMessage) JSON() string {
// checkAdminConfigResetSyntax - validate all the passed arguments // checkAdminConfigResetSyntax - validate all the passed arguments
func checkAdminConfigResetSyntax(ctx *cli.Context) { func checkAdminConfigResetSyntax(ctx *cli.Context) {
if !ctx.Args().Present() { if !ctx.Args().Present() {
showCommandHelpAndExit(ctx, "reset", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -77,7 +77,7 @@ func (u configRestoreMessage) JSON() string {
// checkAdminConfigRestoreSyntax - validate all the passed arguments // checkAdminConfigRestoreSyntax - validate all the passed arguments
func checkAdminConfigRestoreSyntax(ctx *cli.Context) { func checkAdminConfigRestoreSyntax(ctx *cli.Context) {
if !ctx.Args().Present() || len(ctx.Args()) > 2 { 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
} }
} }

View File

@@ -88,7 +88,7 @@ func (u configSetMessage) JSON() string {
// checkAdminConfigSetSyntax - validate all the passed arguments // checkAdminConfigSetSyntax - validate all the passed arguments
func checkAdminConfigSetSyntax(ctx *cli.Context) { func checkAdminConfigSetSyntax(ctx *cli.Context) {
if !ctx.Args().Present() && len(ctx.Args()) < 1 { 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
} }
} }

View File

@@ -56,7 +56,7 @@ EXAMPLES:
// checkAdminDecommissionCancelSyntax - validate all the passed arguments // checkAdminDecommissionCancelSyntax - validate all the passed arguments
func checkAdminDecommissionCancelSyntax(ctx *cli.Context) { func checkAdminDecommissionCancelSyntax(ctx *cli.Context) {
if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 { 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
} }
} }

View File

@@ -52,7 +52,7 @@ EXAMPLES:
// checkAdminDecommissionStartSyntax - validate all the passed arguments // checkAdminDecommissionStartSyntax - validate all the passed arguments
func checkAdminDecommissionStartSyntax(ctx *cli.Context) { func checkAdminDecommissionStartSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -57,7 +57,7 @@ EXAMPLES:
// checkAdminDecommissionStatusSyntax - validate all the passed arguments // checkAdminDecommissionStatusSyntax - validate all the passed arguments
func checkAdminDecommissionStatusSyntax(ctx *cli.Context) { func checkAdminDecommissionStatusSyntax(ctx *cli.Context) {
if len(ctx.Args()) > 2 || len(ctx.Args()) == 0 { 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
} }
} }

View File

@@ -54,7 +54,7 @@ EXAMPLES:
// checkAdminGroupAddSyntax - validate all the passed arguments // checkAdminGroupAddSyntax - validate all the passed arguments
func checkAdminGroupAddSyntax(ctx *cli.Context) { func checkAdminGroupAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 3 { if len(ctx.Args()) < 3 {
showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminGroupEnableSyntax - validate all the passed arguments // checkAdminGroupEnableSyntax - validate all the passed arguments
func checkAdminGroupEnableSyntax(ctx *cli.Context) { func checkAdminGroupEnableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminGroupInfoSyntax - validate all the passed arguments // checkAdminGroupInfoSyntax - validate all the passed arguments
func checkAdminGroupInfoSyntax(ctx *cli.Context) { func checkAdminGroupInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminGroupListSyntax - validate all the passed arguments // checkAdminGroupListSyntax - validate all the passed arguments
func checkAdminGroupListSyntax(ctx *cli.Context) { func checkAdminGroupListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -53,7 +53,7 @@ EXAMPLES:
// checkAdminGroupRemoveSyntax - validate all the passed arguments // checkAdminGroupRemoveSyntax - validate all the passed arguments
func checkAdminGroupRemoveSyntax(ctx *cli.Context) { func checkAdminGroupRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 2 { if len(ctx.Args()) < 2 {
showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -105,14 +105,14 @@ EXAMPLES:
func checkAdminHealSyntax(ctx *cli.Context) { func checkAdminHealSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { 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 // Check for scan argument
scanArg := ctx.String("scan") scanArg := ctx.String("scan")
scanArg = strings.ToLower(scanArg) scanArg = strings.ToLower(scanArg)
if scanArg != scanNormalMode && scanArg != scanDeepMode { if scanArg != scanNormalMode && scanArg != scanDeepMode {
showCommandHelpAndExit(ctx, "heal", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ EXAMPLES:
func mainAdminIDPGet(ctx *cli.Context) error { func mainAdminIDPGet(ctx *cli.Context) error {
if len(ctx.Args()) < 2 || len(ctx.Args()) > 3 { if len(ctx.Args()) < 2 || len(ctx.Args()) > 3 {
showCommandHelpAndExit(ctx, "get", 1) showCommandHelpAndExit(ctx, 1)
} }
args := ctx.Args() args := ctx.Args()

View File

@@ -53,7 +53,7 @@ EXAMPLES:
func mainAdminIDPList(ctx *cli.Context) error { func mainAdminIDPList(ctx *cli.Context) error {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "ls", 1) showCommandHelpAndExit(ctx, 1)
} }
args := ctx.Args() args := ctx.Args()

View File

@@ -48,7 +48,7 @@ EXAMPLES:
func mainAdminIDPRemove(ctx *cli.Context) error { func mainAdminIDPRemove(ctx *cli.Context) error {
if len(ctx.Args()) != 3 { if len(ctx.Args()) != 3 {
showCommandHelpAndExit(ctx, "rm", 1) showCommandHelpAndExit(ctx, 1)
} }
args := ctx.Args() args := ctx.Args()

View File

@@ -84,7 +84,7 @@ func validateIDType(idpType string) {
func mainAdminIDPSet(ctx *cli.Context) error { func mainAdminIDPSet(ctx *cli.Context) error {
if len(ctx.Args()) < 3 { if len(ctx.Args()) < 3 {
showCommandHelpAndExit(ctx, "set", 1) showCommandHelpAndExit(ctx, 1)
} }
args := ctx.Args() args := ctx.Args()

View File

@@ -322,7 +322,7 @@ func (u clusterStruct) JSON() string {
// checkAdminInfoSyntax - validate arguments passed by a user // checkAdminInfoSyntax - validate arguments passed by a user
func checkAdminInfoSyntax(ctx *cli.Context) { func checkAdminInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -53,7 +53,7 @@ EXAMPLES:
// adminKMSCreateKeyCmd is the handler for the "mc admin kms key create" command. // adminKMSCreateKeyCmd is the handler for the "mc admin kms key create" command.
func mainAdminKMSCreateKey(ctx *cli.Context) error { func mainAdminKMSCreateKey(ctx *cli.Context) error {
if len(ctx.Args()) != 2 { 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)) client, err := newAdminClient(ctx.Args().Get(0))

View File

@@ -54,7 +54,7 @@ EXAMPLES:
// adminKMSKeyCmd is the handle for the "mc admin kms key" command. // adminKMSKeyCmd is the handle for the "mc admin kms key" command.
func mainAdminKMSKeyStatus(ctx *cli.Context) error { func mainAdminKMSKeyStatus(ctx *cli.Context) error {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { 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)) console.SetColor("StatusSuccess", color.New(color.FgGreen, color.Bold))

View File

@@ -60,7 +60,7 @@ EXAMPLES:
// checkAdminPolicyAddSyntax - validate all the passed arguments // checkAdminPolicyAddSyntax - validate all the passed arguments
func checkAdminPolicyAddSyntax(ctx *cli.Context) { func checkAdminPolicyAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 { if len(ctx.Args()) != 3 {
showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -65,7 +65,7 @@ EXAMPLES:
// checkAdminPolicyInfoSyntax - validate all the passed arguments // checkAdminPolicyInfoSyntax - validate all the passed arguments
func checkAdminPolicyInfoSyntax(ctx *cli.Context) { func checkAdminPolicyInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminPolicyListSyntax - validate all the passed arguments // checkAdminPolicyListSyntax - validate all the passed arguments
func checkAdminPolicyListSyntax(ctx *cli.Context) { func checkAdminPolicyListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -52,7 +52,7 @@ EXAMPLES:
// checkAdminPolicyRemoveSyntax - validate all the passed arguments // checkAdminPolicyRemoveSyntax - validate all the passed arguments
func checkAdminPolicyRemoveSyntax(ctx *cli.Context) { func checkAdminPolicyRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -62,7 +62,7 @@ var errBadUserGroupArg = errors.New("Last argument must be of the form user=xx o
func checkAdminPolicySetSyntax(ctx *cli.Context) { func checkAdminPolicySetSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 { if len(ctx.Args()) != 3 {
showCommandHelpAndExit(ctx, "set", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ EXAMPLES:
func checkAdminPolicyUnsetSyntax(ctx *cli.Context) { func checkAdminPolicyUnsetSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 { if len(ctx.Args()) != 3 {
showCommandHelpAndExit(ctx, "unset", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ EXAMPLES:
func checkAdminPolicyUpdateSyntax(ctx *cli.Context) { func checkAdminPolicyUpdateSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 3 { if len(ctx.Args()) != 3 {
showCommandHelpAndExit(ctx, "update", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -139,7 +139,7 @@ var defaultConfig = PrometheusConfig{
// checkAdminPrometheusSyntax - validate all the passed arguments // checkAdminPrometheusSyntax - validate all the passed arguments
func checkAdminPrometheusSyntax(ctx *cli.Context) { func checkAdminPrometheusSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "generate", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ const (
// checkSupportMetricsSyntax - validate arguments passed by a user // checkSupportMetricsSyntax - validate arguments passed by a user
func checkSupportMetricsSyntax(ctx *cli.Context) { func checkSupportMetricsSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -68,7 +68,7 @@ func (r rebalanceStartMsg) String() string {
func mainAdminRebalanceStart(ctx *cli.Context) error { func mainAdminRebalanceStart(ctx *cli.Context) error {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
console.SetColor("rebalanceStartMsg", color.New(color.FgGreen)) console.SetColor("rebalanceStartMsg", color.New(color.FgGreen))

View File

@@ -54,7 +54,7 @@ EXAMPLES:
func mainAdminRebalanceStatus(ctx *cli.Context) error { func mainAdminRebalanceStatus(ctx *cli.Context) error {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
args := ctx.Args() args := ctx.Args()

View File

@@ -67,7 +67,7 @@ func (r rebalanceStopMsg) String() string {
func mainAdminRebalanceStop(ctx *cli.Context) error { func mainAdminRebalanceStop(ctx *cli.Context) error {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
console.SetColor("rebalanceStopMsg", color.New(color.FgGreen)) console.SetColor("rebalanceStopMsg", color.New(color.FgGreen))

View File

@@ -85,7 +85,7 @@ func checkAdminReplicateEditSyntax(ctx *cli.Context) {
// Check argument count // Check argument count
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 1 { 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 { if argsNr != 1 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -87,7 +87,7 @@ EXAMPLES:
// checkAdminTopAPISyntax - validate all the passed arguments // checkAdminTopAPISyntax - validate all the passed arguments
func checkAdminScannerInfoSyntax(ctx *cli.Context) { func checkAdminScannerInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { 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
} }
} }

View File

@@ -85,7 +85,7 @@ EXAMPLES:
func checkAdminScannerTraceSyntax(ctx *cli.Context) { func checkAdminScannerTraceSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -70,7 +70,7 @@ func (s serviceFreezeCommand) JSON() string {
// checkAdminServiceFreezeSyntax - validate all the passed arguments // checkAdminServiceFreezeSyntax - validate all the passed arguments
func checkAdminServiceFreezeSyntax(ctx *cli.Context) { func checkAdminServiceFreezeSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "freeze", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -98,7 +98,7 @@ func (s serviceRestartMessage) JSON() string {
// checkAdminServiceRestartSyntax - validate all the passed arguments // checkAdminServiceRestartSyntax - validate all the passed arguments
func checkAdminServiceRestartSyntax(ctx *cli.Context) { func checkAdminServiceRestartSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "restart", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -69,7 +69,7 @@ func (s serviceStopMessage) JSON() string {
// checkAdminServiceStopSyntax - validate all the passed arguments // checkAdminServiceStopSyntax - validate all the passed arguments
func checkAdminServiceStopSyntax(ctx *cli.Context) { func checkAdminServiceStopSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { 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
} }
} }

View File

@@ -69,7 +69,7 @@ func (s serviceUnfreezeCommand) JSON() string {
// checkAdminServiceUnfreezeSyntax - validate all the passed arguments // checkAdminServiceUnfreezeSyntax - validate all the passed arguments
func checkAdminServiceUnfreezeSyntax(ctx *cli.Context) { func checkAdminServiceUnfreezeSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "unfreeze", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -133,7 +133,7 @@ EXAMPLES:
func checkAdminTierAddSyntax(ctx *cli.Context) { func checkAdminTierAddSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 3 { 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 { if argsNr > 3 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -89,7 +89,7 @@ EXAMPLES:
func checkAdminTierEditSyntax(ctx *cli.Context) { func checkAdminTierEditSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 2 { 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 { if argsNr > 2 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -61,7 +61,7 @@ EXAMPLES:
func checkAdminTierInfoSyntax(ctx *cli.Context) { func checkAdminTierInfoSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 1 { 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 { if argsNr > 2 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -53,7 +53,7 @@ EXAMPLES:
func checkAdminTierListSyntax(ctx *cli.Context) { func checkAdminTierListSyntax(ctx *cli.Context) {
argsNr := len(ctx.Args()) argsNr := len(ctx.Args())
if argsNr < 1 { 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 { if argsNr > 1 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -51,7 +51,7 @@ func mainAdminTierRm(ctx *cli.Context) error {
args := ctx.Args() args := ctx.Args()
nArgs := len(args) nArgs := len(args)
if nArgs < 2 { if nArgs < 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
if nArgs != 2 { if nArgs != 2 {
fatalIf(errInvalidArgument().Trace(args.Tail()...), fatalIf(errInvalidArgument().Trace(args.Tail()...),

View File

@@ -51,7 +51,7 @@ func mainAdminTierVerify(ctx *cli.Context) error {
args := ctx.Args() args := ctx.Args()
nArgs := len(args) nArgs := len(args)
if nArgs < 2 { if nArgs < 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
if nArgs != 2 { if nArgs != 2 {
fatalIf(errInvalidArgument().Trace(args.Tail()...), fatalIf(errInvalidArgument().Trace(args.Tail()...),

View File

@@ -124,7 +124,7 @@ var colors = []color.Attribute{color.FgCyan, color.FgWhite, color.FgYellow, colo
func checkAdminTraceSyntax(ctx *cli.Context) { func checkAdminTraceSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "trace", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -83,7 +83,7 @@ func (s serverUpdateMessage) JSON() string {
// checkAdminServerUpdateSyntax - validate all the passed arguments // checkAdminServerUpdateSyntax - validate all the passed arguments
func checkAdminServerUpdateSyntax(ctx *cli.Context) { func checkAdminServerUpdateSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { 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
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminUserDisableSyntax - validate all the passed arguments // checkAdminUserDisableSyntax - validate all the passed arguments
func checkAdminUserDisableSyntax(ctx *cli.Context) { func checkAdminUserDisableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "disable", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminUserEnableSyntax - validate all the passed arguments // checkAdminUserEnableSyntax - validate all the passed arguments
func checkAdminUserEnableSyntax(ctx *cli.Context) { func checkAdminUserEnableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminUserAddSyntax - validate all the passed arguments // checkAdminUserAddSyntax - validate all the passed arguments
func checkAdminUserInfoSyntax(ctx *cli.Context) { func checkAdminUserInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminUserListSyntax - validate all the passed arguments // checkAdminUserListSyntax - validate all the passed arguments
func checkAdminUserListSyntax(ctx *cli.Context) { func checkAdminUserListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "list", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -52,7 +52,7 @@ EXAMPLES:
// checkAdminUserPolicySyntax - validate all the passed arguments // checkAdminUserPolicySyntax - validate all the passed arguments
func checkAdminUserPolicySyntax(ctx *cli.Context) { func checkAdminUserPolicySyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "policy", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -49,7 +49,7 @@ EXAMPLES:
// checkAdminUserRemoveSyntax - validate all the passed arguments // checkAdminUserRemoveSyntax - validate all the passed arguments
func checkAdminUserRemoveSyntax(ctx *cli.Context) { func checkAdminUserRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -75,7 +75,7 @@ EXAMPLES:
// checkAdminUserSvcAcctAddSyntax - validate all the passed arguments // checkAdminUserSvcAcctAddSyntax - validate all the passed arguments
func checkAdminUserSvcAcctAddSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "add", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminUserSvcAcctDisableSyntax - validate all the passed arguments // checkAdminUserSvcAcctDisableSyntax - validate all the passed arguments
func checkAdminUserSvcAcctDisableSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctDisableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "disable", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminUserSvcAcctEnableSyntax - validate all the passed arguments // checkAdminUserSvcAcctEnableSyntax - validate all the passed arguments
func checkAdminUserSvcAcctEnableSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctEnableSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "enable", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -61,7 +61,7 @@ EXAMPLES:
// checkAdminUserSvcAcctInfoSyntax - validate all the passed arguments // checkAdminUserSvcAcctInfoSyntax - validate all the passed arguments
func checkAdminUserSvcAcctInfoSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "info", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -53,7 +53,7 @@ EXAMPLES:
// checkAdminUserSvcAcctListSyntax - validate all the passed arguments // checkAdminUserSvcAcctListSyntax - validate all the passed arguments
func checkAdminUserSvcAcctListSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "ls", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkAdminUserSvcAcctRemoveSyntax - validate all the passed arguments // checkAdminUserSvcAcctRemoveSyntax - validate all the passed arguments
func checkAdminUserSvcAcctRemoveSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "rm", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -62,7 +62,7 @@ EXAMPLES:
// checkAdminUserSvcAcctSetSyntax - validate all the passed arguments // checkAdminUserSvcAcctSetSyntax - validate all the passed arguments
func checkAdminUserSvcAcctSetSyntax(ctx *cli.Context) { func checkAdminUserSvcAcctSetSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "edit", 1) showCommandHelpAndExit(ctx, 1)
} }
} }

View File

@@ -70,7 +70,7 @@ func checkAliasImportSyntax(ctx *cli.Context) {
argsNr := len(args) argsNr := len(args)
if argsNr == 0 { if argsNr == 0 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) showCommandHelpAndExit(ctx, 1)
} }
if argsNr > 2 { if argsNr > 2 {
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...), fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),

View File

@@ -106,7 +106,7 @@ func checkAliasSetSyntax(ctx *cli.Context, accessKey string, secretKey string, d
argsNr := len(args) argsNr := len(args)
if argsNr == 0 { 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 { if argsNr > 4 || argsNr < 2 {

View File

@@ -178,11 +178,11 @@ func checkAnonymousSyntax(ctx *cli.Context) {
argsLength := len(ctx.Args()) argsLength := len(ctx.Args())
// Always print a help message when we have extra arguments // Always print a help message when we have extra arguments
if argsLength > 3 { 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 // Always print a help message when no arguments specified
if argsLength < 1 { if argsLength < 1 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
firstArg := ctx.Args().Get(0) firstArg := ctx.Args().Get(0)
@@ -193,7 +193,7 @@ func checkAnonymousSyntax(ctx *cli.Context) {
case "set": case "set":
// Always expect three arguments when setting a anonymous permission. // Always expect three arguments when setting a anonymous permission.
if argsLength != 3 { if argsLength != 3 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
if accessPerms(secondArg) != accessNone && if accessPerms(secondArg) != accessNone &&
accessPerms(secondArg) != accessDownload && accessPerms(secondArg) != accessDownload &&
@@ -207,25 +207,25 @@ func checkAnonymousSyntax(ctx *cli.Context) {
case "set-json": case "set-json":
// Always expect three arguments when setting a anonymous permission. // Always expect three arguments when setting a anonymous permission.
if argsLength != 3 { if argsLength != 3 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
case "get", "get-json": case "get", "get-json":
// get or get-json always expects two arguments // get or get-json always expects two arguments
if argsLength != 2 { if argsLength != 2 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
case "list": case "list":
// Always expect an argument after list cmd // Always expect an argument after list cmd
if argsLength != 2 { if argsLength != 2 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
case "links": case "links":
// Always expect an argument after links cmd // Always expect an argument after links cmd
if argsLength != 2 { if argsLength != 2 {
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
default: 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")) runAnonymousLinksCmd(ctx.Args().Tail(), ctx.Bool("recursive"))
default: default:
// Shows command example and exit // Shows command example and exit
showCommandHelpAndExit(ctx, "anonymous", 1) showCommandHelpAndExit(ctx, 1)
} }
return nil return nil
} }

View File

@@ -50,7 +50,7 @@ EXAMPLES:
// checkBatchDescribeSyntax - validate all the passed arguments // checkBatchDescribeSyntax - validate all the passed arguments
func checkBatchDescribeSyntax(ctx *cli.Context) { func checkBatchDescribeSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -63,7 +63,7 @@ func supportedJobTypes() string {
// checkBatchGenerateSyntax - validate all the passed arguments // checkBatchGenerateSyntax - validate all the passed arguments
func checkBatchGenerateSyntax(ctx *cli.Context) { func checkBatchGenerateSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -120,7 +120,7 @@ func (c batchListMessage) JSON() string {
// checkBatchListSyntax - validate all the passed arguments // checkBatchListSyntax - validate all the passed arguments
func checkBatchListSyntax(ctx *cli.Context) { func checkBatchListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -75,7 +75,7 @@ func (c batchStartMessage) JSON() string {
// checkBatchStartSyntax - validate all the passed arguments // checkBatchStartSyntax - validate all the passed arguments
func checkBatchStartSyntax(ctx *cli.Context) { func checkBatchStartSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -44,7 +44,7 @@ EXAMPLES:
// checkBatchStatusSyntax - validate all the passed arguments // checkBatchStatusSyntax - validate all the passed arguments
func checkBatchStatusSyntax(ctx *cli.Context) { func checkBatchStatusSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -31,9 +31,9 @@ import (
func checkCopySyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) { func checkCopySyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) {
if len(cliCtx.Args()) < 2 { if len(cliCtx.Args()) < 2 {
if isMvCmd { 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. // extract URLs.

View File

@@ -116,7 +116,7 @@ func (d diffMessage) JSON() string {
func checkDiffSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) { func checkDiffSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if len(cliCtx.Args()) != 2 { 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() { for _, arg := range cliCtx.Args() {
if strings.TrimSpace(arg) == "" { if strings.TrimSpace(arg) == "" {

View File

@@ -206,7 +206,7 @@ func du(ctx context.Context, urlStr string, timeRef time.Time, withVersions bool
// main for du command. // main for du command.
func mainDu(cliCtx *cli.Context) error { func mainDu(cliCtx *cli.Context) error {
if !cliCtx.Args().Present() { if !cliCtx.Args().Present() {
showCommandHelpAndExit(cliCtx, "du", 1) showCommandHelpAndExit(cliCtx, 1)
} }
// Set colors. // Set colors.

View File

@@ -53,7 +53,7 @@ EXAMPLES:
// checkEncryptClearSyntax - validate all the passed arguments // checkEncryptClearSyntax - validate all the passed arguments
func checkEncryptClearSyntax(ctx *cli.Context) { func checkEncryptClearSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "clear", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -53,7 +53,7 @@ EXAMPLES:
// checkversionInfoSyntax - validate all the passed arguments // checkversionInfoSyntax - validate all the passed arguments
func checkEncryptInfoSyntax(ctx *cli.Context) { func checkEncryptInfoSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -57,7 +57,7 @@ EXAMPLES:
// checkEncryptSetSyntax - validate all the passed arguments // checkEncryptSetSyntax - validate all the passed arguments
func checkEncryptSetSyntax(ctx *cli.Context) { func checkEncryptSetSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 2 || len(ctx.Args()) > 3 { 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
} }
} }

View File

@@ -82,7 +82,7 @@ EXAMPLES:
// checkEventAddSyntax - validate all the passed arguments // checkEventAddSyntax - validate all the passed arguments
func checkEventAddSyntax(ctx *cli.Context) { func checkEventAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 { if len(ctx.Args()) != 2 {
showCommandHelpAndExit(ctx, "add", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
} }

View File

@@ -58,7 +58,7 @@ EXAMPLES:
// checkEventListSyntax - validate all the passed arguments // checkEventListSyntax - validate all the passed arguments
func checkEventListSyntax(ctx *cli.Context) { func checkEventListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 2 && len(ctx.Args()) != 1 { 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
} }
} }

View File

@@ -76,7 +76,7 @@ EXAMPLES:
// checkEventRemoveSyntax - validate all the passed arguments // checkEventRemoveSyntax - validate all the passed arguments
func checkEventRemoveSyntax(ctx *cli.Context) { func checkEventRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { 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") { if len(ctx.Args()) == 1 && !ctx.Bool("force") {
fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications.") fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all bucket notifications.")

View File

@@ -156,7 +156,7 @@ func (i ilmAddMessage) JSON() string {
// Validate user given arguments // Validate user given arguments
func checkILMAddSyntax(ctx *cli.Context) { func checkILMAddSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "add", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
} }

View File

@@ -100,7 +100,7 @@ func (i ilmEditMessage) JSON() string {
// Validate user given arguments // Validate user given arguments
func checkILMEditSyntax(ctx *cli.Context) { func checkILMEditSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "edit", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
id := ctx.String("id") id := ctx.String("id")
if id == "" { if id == "" {

View File

@@ -75,7 +75,7 @@ func (i ilmExportMessage) JSON() string {
// checkILMExportSyntax - validate arguments passed by user // checkILMExportSyntax - validate arguments passed by user
func checkILMExportSyntax(ctx *cli.Context) { func checkILMExportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "export", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
} }

View File

@@ -85,7 +85,7 @@ func readILMConfig() (*lifecycle.Configuration, *probe.Error) {
// checkILMImportSyntax - validate arguments passed by user // checkILMImportSyntax - validate arguments passed by user
func checkILMImportSyntax(ctx *cli.Context) { func checkILMImportSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "import", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
} }

View File

@@ -166,7 +166,7 @@ func validateILMListFlagSet(ctx *cli.Context) bool {
// checkILMListSyntax - validate arguments passed by a user // checkILMListSyntax - validate arguments passed by a user
func checkILMListSyntax(ctx *cli.Context) { func checkILMListSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "ls", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
if !validateILMListFlagSet(ctx) { if !validateILMListFlagSet(ctx) {

View File

@@ -91,7 +91,7 @@ EXAMPLES:
// checkILMRestoreSyntax - validate arguments passed by user // checkILMRestoreSyntax - validate arguments passed by user
func checkILMRestoreSyntax(ctx *cli.Context) { func checkILMRestoreSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "restore", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
if ctx.Int("days") <= 0 { if ctx.Int("days") <= 0 {

View File

@@ -95,7 +95,7 @@ func (i ilmRmMessage) JSON() string {
func checkILMRemoveSyntax(ctx *cli.Context) { func checkILMRemoveSyntax(ctx *cli.Context) {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "rm", globalErrorExitStatus) showCommandHelpAndExit(ctx, globalErrorExitStatus)
} }
ilmAll := ctx.Bool("all") ilmAll := ctx.Bool("all")

View File

@@ -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) { func parseLegalHoldArgs(cliCtx *cli.Context) (targetURL, versionID string, timeRef time.Time, recursive, withVersions bool) {
args := cliCtx.Args() args := cliCtx.Args()
if len(args) != 1 { if len(args) != 1 {
showCommandHelpAndExit(cliCtx, cliCtx.Command.Name, 1) showCommandHelpAndExit(cliCtx, 1)
} }
targetURL = args[0] targetURL = args[0]

View File

@@ -173,7 +173,7 @@ func initLicInfoColors() {
func mainLicenseInfo(ctx *cli.Context) error { func mainLicenseInfo(ctx *cli.Context) error {
if len(ctx.Args()) != 1 { if len(ctx.Args()) != 1 {
showCommandHelpAndExit(ctx, "info", 1) // last argument is exit code showCommandHelpAndExit(ctx, 1) // last argument is exit code
} }
initLicInfoColors() initLicInfoColors()

Some files were not shown because too many files have changed in this diff Show More