diff --git a/cli/required.go b/cli/required.go index 454e247613..bad1624856 100644 --- a/cli/required.go +++ b/cli/required.go @@ -27,16 +27,16 @@ func NoArgs(cmd *cobra.Command, args []string) error { } // RequiresMinArgs returns an error if there is not at least min args -func RequiresMinArgs(min int) cobra.PositionalArgs { +func RequiresMinArgs(minArgs int) cobra.PositionalArgs { return func(cmd *cobra.Command, args []string) error { - if len(args) >= min { + if len(args) >= minArgs { return nil } return errors.Errorf( "%q requires at least %d %s.\nSee '%s --help'.\n\nUsage: %s\n\n%s", cmd.CommandPath(), - min, - pluralize("argument", min), + minArgs, + pluralize("argument", minArgs), cmd.CommandPath(), cmd.UseLine(), cmd.Short, @@ -45,16 +45,16 @@ func RequiresMinArgs(min int) cobra.PositionalArgs { } // RequiresMaxArgs returns an error if there is not at most max args -func RequiresMaxArgs(max int) cobra.PositionalArgs { +func RequiresMaxArgs(maxArgs int) cobra.PositionalArgs { return func(cmd *cobra.Command, args []string) error { - if len(args) <= max { + if len(args) <= maxArgs { return nil } return errors.Errorf( "%q requires at most %d %s.\nSee '%s --help'.\n\nUsage: %s\n\n%s", cmd.CommandPath(), - max, - pluralize("argument", max), + maxArgs, + pluralize("argument", maxArgs), cmd.CommandPath(), cmd.UseLine(), cmd.Short, @@ -63,17 +63,17 @@ func RequiresMaxArgs(max int) cobra.PositionalArgs { } // RequiresRangeArgs returns an error if there is not at least min args and at most max args -func RequiresRangeArgs(min int, max int) cobra.PositionalArgs { +func RequiresRangeArgs(minArgs int, maxArgs int) cobra.PositionalArgs { return func(cmd *cobra.Command, args []string) error { - if len(args) >= min && len(args) <= max { + if len(args) >= minArgs && len(args) <= maxArgs { return nil } return errors.Errorf( "%q requires at least %d and at most %d %s.\nSee '%s --help'.\n\nUsage: %s\n\n%s", cmd.CommandPath(), - min, - max, - pluralize("argument", max), + minArgs, + maxArgs, + pluralize("argument", maxArgs), cmd.CommandPath(), cmd.UseLine(), cmd.Short,