Documentation ¶
Index ¶
- Constants
- func AddFlagToCommand(command []string, flag string) []string
- func AddGlobalFlags(cmd *cobra.Command, defaultInteractive bool)
- func FlagsInterceptor(streams ioutils.Streams) interceptors.Interceptor
- func NoFlagName(name string) string
- func RegisterNoableBool(flags *pflag.FlagSet, name string, value bool, usage string) *bool
- func RegisterNoableBoolP(flags *pflag.FlagSet, name string, shorthand string, defaultValue bool, ...) *bool
- type MultiString
Constants ¶
const ( AspectFlagPrefix = "aspect:" AspectLockVersion = AspectFlagPrefix + "lock_version" AspectConfigFlagName = AspectFlagPrefix + "config" AspectSystemConfigFlagName = AspectFlagPrefix + "system_config" AspectWorkspaceConfigFlagName = AspectFlagPrefix + "workspace_config" AspectHomeConfigFlagName = AspectFlagPrefix + "home_config" AspectInteractiveFlagName = AspectFlagPrefix + "interactive" AspectForceBesBackendFlagName = AspectFlagPrefix + "force_bes_backend" AspectDisablePluginsFlagName = AspectFlagPrefix + "disable_plugins" )
const ( BoolFlagTrue = "true" BoolFlagFalse = "false" BoolFlagYes = "yes" BoolFlagNo = "no" BoolFlag1 = "1" BoolFlag0 = "0" )
const (
// The prefix that Bazel & Aspect use for negative flags such as --nohome_rc && --aspect:nohome_config
NoFlagPrefix = "no"
)
Variables ¶
This section is empty.
Functions ¶
func AddFlagToCommand ¶ added in v1.508.0
func AddGlobalFlags ¶
func FlagsInterceptor ¶
func FlagsInterceptor(streams ioutils.Streams) interceptors.Interceptor
func NoFlagName ¶ added in v1.0.1
Prefixes a flag name with "no" to determine the Bazel negative flag from a flag name. Also takes into consideration the 'aspect:' prefix so that a flag such as 'aspect:foo' get a negative flag name of 'aspect:nofoo'. For example, `nohome_rc` is the negative of `home_rc` and `aspect:nohome_config` is the negative of 'aspect:home_config'
func RegisterNoableBool ¶ added in v0.12.0
RegisterNoableBool registers a boolean flag that supports Bazel option parsing.
func RegisterNoableBoolP ¶ added in v0.12.0
func RegisterNoableBoolP( flags *pflag.FlagSet, name string, shorthand string, defaultValue bool, usage string) *bool
RegisterNoableBoolP registers a boolean flag that supports Bazel option parsing with a shorthand. https://bazel.build/reference/command-line-reference#option-syntax
By default the noable variants are -[no]foo which mimics how Bazel handles boolean flags. For Aspect CLI flags, which start with 'aspect:', the noable variants are --aspect:[no]foo.
This implementation normalizes any user-provided values before processing. Hence, `--foo=yes` is the same as `--foo=YES`.
Examples:
--foo --nofoo --foo=yes --foo=no --foo=1 --foo=0
Types ¶
type MultiString ¶
type MultiString struct {
// contains filtered or unexported fields
}
MultiString is the golang implementation of bazel multi-string arguments that satisfies Value from cobra's Flags().Var functions.
func (*MultiString) First ¶
func (s *MultiString) First() string
First satisfies Value from cobra's Flags().Var functions
func (*MultiString) Get ¶ added in v1.0.1
func (s *MultiString) Get() []string
func (*MultiString) Set ¶
func (s *MultiString) Set(value string) error
Set satisfies Value from cobra's Flags().Var functions.
func (*MultiString) String ¶
func (s *MultiString) String() string
String satisfies Value from cobra's Flags().Var functions.
func (*MultiString) Type ¶
func (s *MultiString) Type() string
Type satisfies Value from cobra's Flags().Var functions.