flags

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeInt    = "int"
	TypeString = "string"
)

set of known flag types

Variables

This section is empty.

Functions

func MarkHidden

func MarkHidden(fs *pflag.FlagSet, name string)

MarkHidden marks the specified flag as hidden from the provided flag set TODO(REALMC-8369): this method should go away if/when we can get golangci-lint to play nicely with errcheck and our exclude .errcheck file For now, we use this to isolate and minimize the nolint directives in this repo

Types

type Arg

type Arg struct {
	Name  string
	Value interface{}
}

Arg is a flag arg represented by its name and optional value

func (Arg) String

func (a Arg) String() string

type Date

type Date struct {
	Time time.Time
}

Date is a date flag

func (*Date) Set

func (d *Date) Set(val string) error

Set adds new values to the EnumSetValue

func (Date) String

func (d Date) String() string

func (Date) Type

func (d Date) Type() string

Type returns the date flag type

type EnumSetValue

type EnumSetValue struct {
	// contains filtered or unexported fields
}

EnumSetValue is a modified copy of stringSliceValue from the cobra pflags package. It validates a set of enum values. Note: it does NOT maintain order of the input arguments

func NewEnumSet

func NewEnumSet(p *[]string, validValues []interface{}) *EnumSetValue

NewEnumSet creates an EnumSetValue. Expects p to point to an empty slice and will clear it otherwise.

func (*EnumSetValue) Append

func (esv *EnumSetValue) Append(val string) error

Append appends a single value to an EnumSetValue

func (*EnumSetValue) GetSlice

func (esv *EnumSetValue) GetSlice() []string

GetSlice returns the underlying slice of the set of the EnumSetValue

func (*EnumSetValue) Replace

func (esv *EnumSetValue) Replace(values []string) error

Replace replaces all values in an EnumSetValue

func (*EnumSetValue) Set

func (esv *EnumSetValue) Set(val string) error

Set adds new values to the EnumSetValue

func (*EnumSetValue) String

func (esv *EnumSetValue) String() string

String returns a string representation of an EnumSetValue

func (*EnumSetValue) Type

func (esv *EnumSetValue) Type() string

Type returns the type string of EnumSetValue

Jump to

Keyboard shortcuts

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