flags

package
v0.175.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureCommandLineFlags added in v0.57.0

func CaptureCommandLineFlags(set *pflag.FlagSet) map[string]interface{}

CaptureCommandLineFlags build the map of command line flags of the current execution.

Types

type Device

type Device struct {
	config.Device
	Changed bool
}

Device represents the RDC device configuration.

func (*Device) Set

func (d *Device) Set(s string) error

Set sets the device to the values present in s. The input has to be a comma separated string in the format of "key=value,key2=value2". This method is called by cobra when CLI flags are parsed.

func (Device) String

func (d Device) String() string

String returns a string represenation of the device.

func (Device) Type

func (d Device) Type() string

Type returns the value type.

type Emulator

type Emulator struct {
	config.Emulator
	Changed bool
}

Emulator represents the emulator configuration.

func (*Emulator) Set

func (e *Emulator) Set(s string) error

Set sets the emulator to the values present in s. The input has to be a comma separated string in the format of "key=value,key2=value2". This method is called by cobra when CLI flags are parsed.

func (Emulator) String

func (e Emulator) String() string

String returns a string represenation of the emulator.

func (Emulator) Type

func (e Emulator) Type() string

Type returns the value type.

type QuarantineMode added in v0.70.0

type QuarantineMode struct {
	Values  map[string]interface{}
	Changed bool
}

QuarantineMode represents the testcafe quarantineMode configuration.

func (*QuarantineMode) Set added in v0.70.0

func (q *QuarantineMode) Set(s string) error

Set sets the quarantineMode to the values present in s. The input has to be a comma separated string in the format of "key=value,key2=value2". This method is called by cobra when CLI flags are parsed.

func (QuarantineMode) String added in v0.70.0

func (q QuarantineMode) String() string

String returns a string represenation of the quarantineMode.

func (QuarantineMode) Type added in v0.70.0

func (q QuarantineMode) Type() string

Type returns the value type.

type Simulator

type Simulator struct {
	config.Simulator
	Changed bool
}

Simulator represents the simulator configuration.

func (*Simulator) Set

func (e *Simulator) Set(s string) error

Set sets the simulator to the values present in s. The input has to be a comma separated string in the format of "key=value,key2=value2". This method is called by cobra when CLI flags are parsed.

func (Simulator) String

func (e Simulator) String() string

String returns a string represenation of the simulator.

func (Simulator) Type

func (e Simulator) Type() string

Type returns the value type.

type SnakeCharmer added in v0.52.3

type SnakeCharmer struct {
	Fset *pflag.FlagSet
	// Fmap maps field names (key) to flags (value).
	Fmap map[string]*pflag.Flag
}

SnakeCharmer because Cobra and Viper. Get it? It's a convenience wrapper around cobra and viper, allowing the user to declare and bind flags at the same time.

Example:

	sc := flags.SnakeCharmer{Fmap: map[string]*pflag.Flag{}}
	sc.Fset = cmd.Flags()
	sc.String("name", "suite.name", "", "Set the name of the job as it will appear on Sauce Labs")
 sc.BindAll()

func (*SnakeCharmer) BindAll added in v0.53.0

func (s *SnakeCharmer) BindAll()

BindAll binds all previously added flags to their respective fields.

func (*SnakeCharmer) Bool added in v0.52.3

func (s *SnakeCharmer) Bool(flagName, fieldName string, value bool, usage string)

Bool defines a bool flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) BoolP added in v0.53.0

func (s *SnakeCharmer) BoolP(flagName, shorthand, fieldName string, value bool, usage string)

BoolP is like Bool(), but accepts a shorthand letter.

func (*SnakeCharmer) Duration added in v0.175.0

func (s *SnakeCharmer) Duration(flagName string, fieldName string, value time.Duration, usage string)

Duration defines a duration flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) Float64 added in v0.53.0

func (s *SnakeCharmer) Float64(flagName, fieldName string, value float64, usage string)

Float64 defines a float64 flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) Int added in v0.53.0

func (s *SnakeCharmer) Int(flagName, fieldName string, value int, usage string)

Int defines an int flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) String added in v0.52.3

func (s *SnakeCharmer) String(flagName, fieldName, value, usage string)

String defines a string flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) StringP added in v0.53.0

func (s *SnakeCharmer) StringP(flagName, shorthand, fieldName, value, usage string)

StringP is like String(), but accepts a shorthand letter.

func (*SnakeCharmer) StringSlice added in v0.53.0

func (s *SnakeCharmer) StringSlice(flagName, fieldName string, value []string, usage string)

StringSlice defines a []string flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) StringToString added in v0.52.3

func (s *SnakeCharmer) StringToString(flagName, fieldName string, value map[string]string, usage string)

StringToString defines a map[string]string flag with specified flagName, default value, usage string and then binds it to fieldName.

func (*SnakeCharmer) StringToStringP added in v0.53.0

func (s *SnakeCharmer) StringToStringP(flagName, shorthand, fieldName string, value map[string]string, usage string)

StringToStringP is like StringToString(), but accepts a shorthand letter.

Jump to

Keyboard shortcuts

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