Documentation ¶
Overview ¶
Package flag implements command-line flag parsing. It's a wrapper of flag pkg in stdlib.
Index ¶
- Constants
- Variables
- func Bool(full, short string, value bool, usage string) *bool
- func BoolVar(p *bool, full, short string, value bool, usage string)
- func Duration(full, short string, value time.Duration, usage string) *time.Duration
- func DurationVar(p *time.Duration, full, short string, value time.Duration, usage string)
- func Float64(full, short string, value float64, usage string) *float64
- func Float64Var(p *float64, full, short string, value float64, usage string)
- func Int(full, short string, value int, usage string) *int
- func Int64(full, short string, value int64, usage string) *int64
- func Int64Var(p *int64, full, short string, value int64, usage string)
- func IntVar(p *int, full, short string, value int, usage string)
- func Parse()
- func Register(f CommonFlag)
- func String(full, short, value, usage string) *string
- func StringVar(p *string, full, short, value, usage string)
- func Uint(full, short string, value uint, usage string) *uint
- func Uint64(full, short string, value uint64, usage string) *uint64
- func Uint64Var(p *uint64, full, short string, value uint64, usage string)
- func UintVar(p *uint, full, short string, value uint, usage string)
- func Usage()
- func Var(v flag.Value, full, short string, usage string)
- type CommonFlag
- type ErrorHandling
- type Flag
- type Set
- func (s *Set) Args() []string
- func (s *Set) Bool(full, short string, value bool, usage string) *bool
- func (s *Set) BoolVar(p *bool, full, short string, value bool, usage string)
- func (s *Set) Duration(full, short string, value time.Duration, usage string) *time.Duration
- func (s *Set) DurationVar(p *time.Duration, full, short string, value time.Duration, usage string)
- func (s *Set) Float64(full, short string, value float64, usage string) *float64
- func (s *Set) Float64Var(p *float64, full, short string, value float64, usage string)
- func (s *Set) Inner() *flag.FlagSet
- func (s *Set) Int(full, short string, value int, usage string) *int
- func (s *Set) Int64(full, short string, value int64, usage string) *int64
- func (s *Set) Int64Var(p *int64, full, short string, value int64, usage string)
- func (s *Set) IntVar(p *int, full, short string, value int, usage string)
- func (s *Set) Lookup(name string) *flag.Flag
- func (s *Set) Parse(args []string)
- func (s *Set) Register(f CommonFlag)
- func (s *Set) Set(name, value string) error
- func (s *Set) SetUsageStyle(style UsageStyle)
- func (s *Set) String(full, short, value, usage string) *string
- func (s *Set) StringVar(p *string, full, short, value, usage string)
- func (s *Set) Uint(full, short string, value uint, usage string) *uint
- func (s *Set) Uint64(full, short string, value uint64, usage string) *uint64
- func (s *Set) Uint64Var(p *uint64, full, short string, value uint64, usage string)
- func (s *Set) UintVar(p *uint, full, short string, value uint, usage string)
- func (s *Set) Usage()
- func (s *Set) Var(v flag.Value, full, short string, usage string)
- type StringList
- type UsageStyle
Constants ¶
View Source
const ( ContinueOnError = flag.ContinueOnError // Return a descriptive error. ExitOnError = flag.ExitOnError // Call os.Exit(2). PanicOnError = flag.PanicOnError // Call panic with a descriptive error. )
Variables ¶
View Source
var Default = Wrap(flag.CommandLine, "")
Functions ¶
func DurationVar ¶
func Register ¶
func Register(f CommonFlag)
Register adds common flags like help/version/profile/config etc.
Types ¶
type ErrorHandling ¶
type ErrorHandling = flag.ErrorHandling
type Set ¶
type Set struct { Desc string // contains filtered or unexported fields }
func NewSet ¶
func NewSet(name, desc string, errorHandling ErrorHandling) *Set
func (*Set) DurationVar ¶
func (*Set) Float64Var ¶
func (*Set) Register ¶
func (s *Set) Register(f CommonFlag)
Register adds common flags like help/version/profile/config etc.
func (*Set) SetUsageStyle ¶
func (s *Set) SetUsageStyle(style UsageStyle)
type StringList ¶
type StringList []string
func (*StringList) Set ¶
func (l *StringList) Set(value string) error
func (*StringList) String ¶
func (l *StringList) String() string
type UsageStyle ¶
type UsageStyle int32
UsageStyle defines the usage style.
const ( // Compact is left-right style Compact UsageStyle = iota // Manual is up-down style Manual )
Click to show internal directories.
Click to hide internal directories.