flagset

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxLineLength is the maximum width of any line.
	MaxLineLength int = 78
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolVar

type BoolVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    bool
	Hidden     bool
	EnvVar     string
	Target     *bool
	Completion complete.Predictor
}

BoolVar is a structure to define a bool flag

type DurationVar

type DurationVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    time.Duration
	Hidden     bool
	EnvVar     string
	Target     *time.Duration
	Completion complete.Predictor
}

DurationVar is a structure to define a duration flag

type FlagBool

type FlagBool interface {
	IsBoolFlag() bool
}

FlagBool is an interface which boolean flags implement.

type FlagExample

type FlagExample interface {
	Example() string
}

FlagExample is an interface which declares an example value.

type FlagSet

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

FlagSet is a grouped wrapper around a real flag set and a grouped flag set.

func NewFlagSet

func NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set.

func (*FlagSet) BoolVar

func (f *FlagSet) BoolVar(i *BoolVar)

BoolVar -- Add a BoolVar in a flagset

func (*FlagSet) DurationVar

func (f *FlagSet) DurationVar(i *DurationVar)

DurationVar -- add a DurationVar in a FlagSet

func (*FlagSet) Float64Var

func (f *FlagSet) Float64Var(i *Float64Var)

Float64Var -- add a Float64Var in a FlagSet

func (*FlagSet) Int64Var

func (f *FlagSet) Int64Var(i *Int64Var)

Int64Var -- add an Int64Var in a flagSet

func (*FlagSet) IntVar

func (f *FlagSet) IntVar(i *IntVar)

IntVar -- add an IntVar in a flagSet

func (*FlagSet) Name

func (f *FlagSet) Name() string

Name returns the name of this flag set.

func (*FlagSet) StringMapVar

func (f *FlagSet) StringMapVar(i *StringMapVar)

StringMapVar -- add a StringMap in a FlagSet

func (*FlagSet) StringSliceVar

func (f *FlagSet) StringSliceVar(i *StringSliceVar)

StringSliceVar -- add a StringSliceVar in a FlagSet

func (*FlagSet) StringVar

func (f *FlagSet) StringVar(i *StringVar)

StringVar -- add an StringVar in a FlagSet

func (*FlagSet) Uint64Var

func (f *FlagSet) Uint64Var(i *Uint64Var)

Uint64Var -- add an unsigned int64 in a FlagSet

func (*FlagSet) UintVar

func (f *FlagSet) UintVar(i *UintVar)

UintVar -- add an unsigned interger in a FlagSet

func (*FlagSet) Var

func (f *FlagSet) Var(value flag.Value, name, usage string)

Var is a lower-level API for adding something to the flags. It should be used with caution, since it bypasses all validation. Consider VarFlag instead.

func (*FlagSet) VarFlag

func (f *FlagSet) VarFlag(i *VarFlag)

VarFlag -- add a VarFlag in a FlagSet

func (*FlagSet) Visit

func (f *FlagSet) Visit(fn func(*flag.Flag))

Visit --

func (*FlagSet) VisitAll

func (f *FlagSet) VisitAll(fn func(*flag.Flag))

VisitAll --

type FlagSets

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

FlagSets is a group of flag sets.

func NewFlagSets

func NewFlagSets(ui cli.Ui) *FlagSets

NewFlagSets creates a new flag sets.

func (*FlagSets) Args

func (f *FlagSets) Args() []string

Args returns the remaining args after parsing.

func (*FlagSets) Completions

func (f *FlagSets) Completions() complete.Flags

Completions returns the completions for this flag set.

func (*FlagSets) Help

func (f *FlagSets) Help() string

Help builds custom help for this command, grouping by flag set.

func (*FlagSets) NewFlagSet

func (f *FlagSets) NewFlagSet(name string) *FlagSet

NewFlagSet creates a new flag set from the given flag sets.

func (*FlagSets) Parse

func (f *FlagSets) Parse(args []string) error

Parse parses the given flags, returning any errors.

func (*FlagSets) Parsed

func (f *FlagSets) Parsed() bool

Parsed reports whether the command-line flags have been parsed.

func (*FlagSets) Visit

func (f *FlagSets) Visit(fn func(*flag.Flag))

Visit visits the flags in lexicographical order, calling fn for each. It visits only those flags that have been set.

type FlagVisibility

type FlagVisibility interface {
	Hidden() bool
}

FlagVisibility is an interface which declares whether a flag should be hidden from help and completions. This is usually used for deprecations on "internal-only" flags.

type Float64Var

type Float64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    float64
	Hidden     bool
	EnvVar     string
	Target     *float64
	Completion complete.Predictor
}

Float64Var is a structure to define a float64 flag

type Int64Var

type Int64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    int64
	Hidden     bool
	EnvVar     string
	Target     *int64
	Completion complete.Predictor
}

Int64Var is a structure to define a int64 flag

type IntVar

type IntVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    int
	Hidden     bool
	EnvVar     string
	Target     *int
	Completion complete.Predictor
}

IntVar is a structure to define a integer flag

type StringMapVar

type StringMapVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    map[string]string
	Hidden     bool
	Target     *map[string]string
	Completion complete.Predictor
}

StringMapVar is a structure to define a string map flag

type StringSliceVar

type StringSliceVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    []string
	Hidden     bool
	EnvVar     string
	Target     *[]string
	Completion complete.Predictor
}

StringSliceVar is a structure to define a slice of string flag

type StringVar

type StringVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    string
	Hidden     bool
	EnvVar     string
	Target     *string
	Completion complete.Predictor
}

StringVar is a structure to define a string flag

type Uint64Var

type Uint64Var struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    uint64
	Hidden     bool
	EnvVar     string
	Target     *uint64
	Completion complete.Predictor
}

Uint64Var is a structure to define a unsigned int64 flag

type UintVar

type UintVar struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    uint
	Hidden     bool
	EnvVar     string
	Target     *uint
	Completion complete.Predictor
}

UintVar is a structure to define a unsigned integer flag

type VarFlag

type VarFlag struct {
	Name       string
	Aliases    []string
	Usage      string
	Default    string
	EnvVar     string
	Value      flag.Value
	Completion complete.Predictor
}

VarFlag is a structure to define a var flag

Jump to

Keyboard shortcuts

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