flagtypes

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteDryRun

func CompleteDryRun(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteDryRun returns completions for the DryRun type.

func CompleteKeyValue

func CompleteKeyValue(keys []string, completed string) ([]string, cobra.ShellCompDirective)

CompleteKeyValue returns key=value completions using the given slice of keys.

func CompleteLogLevel

func CompleteLogLevel(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

CompleteLogLevel returns completions for the LogLevel type.

Types

type DryRun

type DryRun string

DryRun is an enum flag for setting dry-run.

const (
	// DryRunNone disables dry-run. The build will be performed as usual.
	DryRunNone DryRun = "none"
	// DryRunClient only logs what would be run, without contacting Kubernetes.
	DryRunClient DryRun = "client"
	// DryRunServer submits server-side dry-run requests to Kubernetes.
	DryRunServer DryRun = "server"
)

func (*DryRun) Set

func (d *DryRun) Set(value string) error

Set implements the pflag.Value interface. This parses the dry-run string and updates the dry-run variable.

func (*DryRun) String

func (d *DryRun) String() string

String implements the pflag.Value and fmt.Stringer interfaces. This returns a human-readable representation of the dry-run flag.

func (*DryRun) Type

func (d *DryRun) Type() string

Type implements the pflag.Value interface. The value is only used in help text.

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue is a flag that takes in a key=value format.

func (*KeyValue) Set

func (s *KeyValue) Set(val string) error

Set parses a "key=value" string and updates this flag.

func (*KeyValue) String

func (s *KeyValue) String() string

String returns a "key=value" string represetntation for this flag.

func (*KeyValue) Type

func (s *KeyValue) Type() string

Type returns the name of this type.

type KeyValueArray

type KeyValueArray struct {
	Pairs []KeyValue
	// contains filtered or unexported fields
}

KeyValueArray is a flag type that takes in key=value on each flag value and can be specified multiple times.

func (*KeyValueArray) Append

func (s *KeyValueArray) Append(val string) error

Append parses a "key=value" string and adds that to this array.

func (*KeyValueArray) GetSlice

func (s *KeyValueArray) GetSlice() []string

GetSlice returns a slice of "key=value" string representations for all the values.

func (*KeyValueArray) Replace

func (s *KeyValueArray) Replace(val []string) error

Replace parses a slice of "key=value" strings and sets those as this flag's new values.

func (*KeyValueArray) Set

func (s *KeyValueArray) Set(val string) error

Set parses a "key=value" string and updates this flag with that value, overriding the array if it's the first time its set, or appends the value if it's a consecutive call.

func (*KeyValueArray) String

func (s *KeyValueArray) String() string

String returns a "[key1=value,key2=value]" string represetntation for this flag.

func (*KeyValueArray) Type

func (s *KeyValueArray) Type() string

Type returns the name of this type.

type LogLevel

type LogLevel logger.Level

LogLevel is a pflag.Value-compatible logging level flag for wharf-core's logger.Level type.

func (LogLevel) Level

func (l LogLevel) Level() logger.Level

Level is a utility function to return the wharf-core logger.Level value.

func (*LogLevel) Set

func (l *LogLevel) Set(val string) error

Set implements the pflag.Value interface. This parses the loglevel string and updates the loglevel variable.

func (*LogLevel) String

func (l *LogLevel) String() string

String implements the pflag.Value and fmt.Stringer interfaces. This returns a human-readable representation of the loglevel.

func (*LogLevel) Type

func (l *LogLevel) Type() string

Type implements the pflag.Value interface. The value is only used in help text.

Jump to

Keyboard shortcuts

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