MCPcopy Index your code
hub / github.com/cloudfoundry/multiapps-cli-plugin / ValidateBooleanFlag

Function ValidateBooleanFlag

commands/deploy_command.go:822–834  ·  view source on GitHub ↗
(flagName string, flags *flag.FlagSet)

Source from the content-addressed store, hash-verified

820}
821
822func ValidateBooleanFlag(flagName string, flags *flag.FlagSet) error {
823 flagValueStr := flags.Lookup(flagName).Value.String()
824
825 if flagValueStr == "" {
826 return fmt.Errorf("%s flag defined but no argument specified", flagName)
827 }
828
829 if flagValueStr != "true" && flagValueStr != "false" {
830 return fmt.Errorf("Invalid value for %s: %s. Expected true or false.", flagName, flagValueStr)
831 }
832
833 return nil
834}

Callers 1

ValidateParsedFlagsMethod · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected