Option types: bool int, int-array, string, string-array, string-map, file, dir
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package cli
|
|
|
|
import "fmt"
|
|
|
|
func errMissingOptionValue(opt string) error {
|
|
return fmt.Errorf("option %q requires a value", opt)
|
|
}
|
|
|
|
func errOptionAlreadyDefined(opt string) error {
|
|
return fmt.Errorf("option name %q already used", opt)
|
|
}
|
|
|
|
func errRepeatArgAlreadyDefined(argName string) error {
|
|
return fmt.Errorf("repeat property already set for arg <%s>", argName)
|
|
}
|
|
|
|
func errMissingRequiredArg(argName string) error {
|
|
return fmt.Errorf("missing required arg <%s>", argName)
|
|
}
|
|
|
|
func errTooFewArguments(numRequired int) error {
|
|
return fmt.Errorf("too few arguments: ad least %d required", numRequired)
|
|
}
|
|
|
|
func errOptionNotFound(name string) error {
|
|
return fmt.Errorf("option %q not found", name)
|
|
}
|
|
|
|
func errInvalidOptionValue(name string, value any, optType string) error {
|
|
return fmt.Errorf("invalid value %v (%T) for option %q (%s)", value, value, name, optType)
|
|
}
|
|
|
|
func errIncompatibleOptions(currentOptName string, incompatibleOptName string) error {
|
|
return fmt.Errorf("option %q cannot specified together with option %q", currentOptName, incompatibleOptName)
|
|
}
|
|
|
|
func errUnknownOption(name string) error {
|
|
return fmt.Errorf("unknown option %q", name)
|
|
}
|