flags

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFlagName is the --config flag for the root command.
	ConfigFlagName = "aspect:config"
	// InteractiveFlagName is the --interactive flag for the root command.
	InteractiveFlagName = "aspect:interactive"
)
View Source
const (
	BoolFlagTrue  = "true"
	BoolFlagFalse = "false"
	BoolFlagYes   = "yes"
	BoolFlagNo    = "no"
	BoolFlag1     = "1"
	BoolFlag0     = "0"
)

Variables

This section is empty.

Functions

func AddBazelFlags

func AddBazelFlags(cmd *cobra.Command) error

AddBazelFlags will process the configured cobra commands and add bazel flags to those commands.

func AddGlobalFlags

func AddGlobalFlags(cmd *cobra.Command, defaultInteractive bool)

AddGlobalFlags will add aspect specfic flags to all cobra commands.

func FlagsInterceptor

func FlagsInterceptor(streams ioutils.Streams) interceptors.Interceptor

FlagsIntercepor will parse the incoming flags and remove any aspect specific flags or bazel startup flags from the list of args.

func RegisterNoableBool added in v0.12.0

func RegisterNoableBool(flags *pflag.FlagSet, name string, value bool, usage string) *bool

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,
	value 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

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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL