ErrInvalidUsage is returned when there is a validation error.
var ErrInvalidUsage = errors.New("invalid command usage")
func NonEmptyString(args []string) int
NonEmptyString is a validator for non-empty strings.
func String(args []string) int
String is a validator for strings.
func Validate(vs ...Validator) cli.BeforeFunc
Validate can be used as a command's Before function to validate the arguments to the command.
Validator is an argument validator function. It returns the number of arguments consumed or -1 on error.
type Validator = func([]string) int
func Int(base int, min int, max int) Validator
Int returns a validator for integers.
func Optional(v Validator) Validator
Optional returns a validator that treats an argument as optional.
func Rest(v Validator) Validator
Rest returns a validator that validates each of the remaining arguments.