flag

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: BSD-3-Clause Imports: 6 Imported by: 60

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationProvider

func DurationProvider(ctx *completion.ProviderCtx) []string

func WithPrefix

func WithPrefix(name string) string

Types

type BoolFlag

type BoolFlag struct {
	Name       string
	Alias      string
	Value      bool
	Usage      string
	EnvVar     string
	Deprecated string
}

func (BoolFlag) Default

func (f BoolFlag) Default() interface{}

func (BoolFlag) DefaultStr

func (f BoolFlag) DefaultStr() string

func (BoolFlag) DeprecationStr

func (f BoolFlag) DeprecationStr() string

func (BoolFlag) EnvVarStr

func (f BoolFlag) EnvVarStr() string

func (BoolFlag) FullNames

func (f BoolFlag) FullNames() []string

func (BoolFlag) HasLeader

func (f BoolFlag) HasLeader() bool

func (BoolFlag) IsRequired

func (f BoolFlag) IsRequired() bool

func (BoolFlag) MainName

func (f BoolFlag) MainName() string

func (BoolFlag) Parse

func (f BoolFlag) Parse(str string) (interface{}, error)

func (BoolFlag) PlaceholderStr

func (f BoolFlag) PlaceholderStr() string

func (BoolFlag) UsageStr

func (f BoolFlag) UsageStr() string

type DurationFlag

type DurationFlag struct {
	Name  string
	Alias string
	// Value is string instead of time.Duration so help can format it
	// however makes sense, like 120s instead of 2m0s
	Value      string
	Usage      string
	EnvVar     string
	Required   bool
	Deprecated string
}

func (DurationFlag) Default

func (f DurationFlag) Default() interface{}

func (DurationFlag) DefaultStr

func (f DurationFlag) DefaultStr() string

func (DurationFlag) DeprecationStr

func (f DurationFlag) DeprecationStr() string

func (DurationFlag) EnvVarStr

func (f DurationFlag) EnvVarStr() string

func (DurationFlag) FullNames

func (f DurationFlag) FullNames() []string

func (DurationFlag) HasLeader

func (f DurationFlag) HasLeader() bool

func (DurationFlag) IsRequired

func (f DurationFlag) IsRequired() bool

func (DurationFlag) MainName

func (f DurationFlag) MainName() string

func (DurationFlag) Parse

func (f DurationFlag) Parse(str string) (interface{}, error)

func (DurationFlag) PlaceholderStr

func (f DurationFlag) PlaceholderStr() string

func (DurationFlag) UsageStr

func (f DurationFlag) UsageStr() string

type Flag

type Flag interface {
	MainName() string    // without hyphens
	FullNames() []string // with hyphens
	IsRequired() bool
	DeprecationStr() string
	HasLeader() bool

	Default() interface{} // must not be called if flag is required
	Parse(string) (interface{}, error)

	PlaceholderStr() string // must not be called on bool flag
	DefaultStr() string     // must not be called if flag is required
	EnvVarStr() string      // must not be called if flag is required
	UsageStr() string
}

type IntFlag

type IntFlag struct {
	Name       string
	Alias      string
	Value      int
	Usage      string
	EnvVar     string
	Required   bool
	Deprecated string
}

func (IntFlag) Default

func (f IntFlag) Default() interface{}

func (IntFlag) DefaultStr

func (f IntFlag) DefaultStr() string

func (IntFlag) DeprecationStr

func (f IntFlag) DeprecationStr() string

func (IntFlag) EnvVarStr

func (f IntFlag) EnvVarStr() string

func (IntFlag) FullNames

func (f IntFlag) FullNames() []string

func (IntFlag) HasLeader

func (f IntFlag) HasLeader() bool

func (IntFlag) IsRequired

func (f IntFlag) IsRequired() bool

func (IntFlag) MainName

func (f IntFlag) MainName() string

func (IntFlag) Parse

func (f IntFlag) Parse(str string) (interface{}, error)

func (IntFlag) PlaceholderStr

func (f IntFlag) PlaceholderStr() string

func (IntFlag) UsageStr

func (f IntFlag) UsageStr() string

type StringFlag

type StringFlag struct {
	Name        string
	Alias       string
	Value       string
	Usage       string
	Placeholder string
	EnvVar      string
	Required    bool
	Deprecated  string
}

func (StringFlag) Default

func (f StringFlag) Default() interface{}

func (StringFlag) DefaultStr

func (f StringFlag) DefaultStr() string

func (StringFlag) DeprecationStr

func (f StringFlag) DeprecationStr() string

func (StringFlag) EnvVarStr

func (f StringFlag) EnvVarStr() string

func (StringFlag) FullNames

func (f StringFlag) FullNames() []string

func (StringFlag) HasLeader

func (f StringFlag) HasLeader() bool

func (StringFlag) IsRequired

func (f StringFlag) IsRequired() bool

func (StringFlag) MainName

func (f StringFlag) MainName() string

func (StringFlag) Parse

func (f StringFlag) Parse(str string) (interface{}, error)

func (StringFlag) PlaceholderStr

func (f StringFlag) PlaceholderStr() string

func (StringFlag) UsageStr

func (f StringFlag) UsageStr() string

type StringParam

type StringParam struct {
	Name  string
	Usage string
}

func (StringParam) Default

func (f StringParam) Default() interface{}

func (StringParam) DefaultStr

func (f StringParam) DefaultStr() string

func (StringParam) DeprecationStr

func (f StringParam) DeprecationStr() string

func (StringParam) EnvVarStr

func (f StringParam) EnvVarStr() string

func (StringParam) FullNames

func (f StringParam) FullNames() []string

func (StringParam) HasLeader

func (f StringParam) HasLeader() bool

func (StringParam) IsRequired

func (f StringParam) IsRequired() bool

func (StringParam) MainName

func (f StringParam) MainName() string

func (StringParam) Parse

func (f StringParam) Parse(str string) (interface{}, error)

func (StringParam) PlaceholderStr

func (f StringParam) PlaceholderStr() string

func (StringParam) UsageStr

func (f StringParam) UsageStr() string

type StringSlice

type StringSlice struct {
	Name     string
	Usage    string
	Optional bool
}

func (StringSlice) Default

func (f StringSlice) Default() interface{}

func (StringSlice) DefaultStr

func (f StringSlice) DefaultStr() string

func (StringSlice) DeprecationStr

func (f StringSlice) DeprecationStr() string

func (StringSlice) EnvVarStr

func (f StringSlice) EnvVarStr() string

func (StringSlice) FullNames

func (f StringSlice) FullNames() []string

func (StringSlice) HasLeader

func (f StringSlice) HasLeader() bool

func (StringSlice) IsRequired

func (f StringSlice) IsRequired() bool

func (StringSlice) MainName

func (f StringSlice) MainName() string

func (StringSlice) Parse

func (f StringSlice) Parse(str string) (interface{}, error)

func (StringSlice) PlaceholderStr

func (f StringSlice) PlaceholderStr() string

func (StringSlice) UsageStr

func (f StringSlice) UsageStr() string

Jump to

Keyboard shortcuts

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