Versions in this module Expand all Collapse all v0 v0.3.9 Oct 31, 2015 v0.3.8 Oct 19, 2015 Changes in this version + var CommandLine = New(filepath.Base(os.Args[0]), "") + var CompactUsageTemplate = ... + var DefaultUsageTemplate = ... + var ErrCommandNotSpecified = fmt.Errorf("command not specified") + var HelpCommand *CmdClause + var HelpFlag *FlagClause + var LongHelpTemplate = ... + var ManPageTemplate = ... + var SeparateOptionalFlagsUsageTemplate = ... + var TokenEOLMarker = Token + var VersionFlag *FlagClause + func Errorf(format string, args ...interface{}) + func ExpandArgsFromFile(filename string) (out []string, err error) + func FatalIfError(err error, format string, args ...interface{}) + func FatalUsage(format string, args ...interface{}) + func FatalUsageContext(context *ParseContext, format string, args ...interface{}) + func Fatalf(format string, args ...interface{}) + func MustParse(command string, err error) string + func Parse() string + func Usage() + type Action func(*ParseContext) error + type Application struct + Help string + Name string + func New(name, help string) *Application + func UsageTemplate(template string) *Application + func Version(version string) *Application + func (a *Application) Action(action Action) *Application + func (a *Application) Author(author string) *Application + func (a *Application) Command(name, help string) *CmdClause + func (a *Application) Errorf(format string, args ...interface{}) + func (a *Application) FatalIfError(err error, format string, args ...interface{}) + func (a *Application) FatalUsage(format string, args ...interface{}) + func (a *Application) FatalUsageContext(context *ParseContext, format string, args ...interface{}) + func (a *Application) Fatalf(format string, args ...interface{}) + func (a *Application) Interspersed(interspersed bool) *Application + func (a *Application) Model() *ApplicationModel + func (a *Application) Parse(args []string) (command string, err error) + func (a *Application) ParseContext(args []string) (*ParseContext, error) + func (a *Application) PreAction(action Action) *Application + func (a *Application) Terminate(terminate func(int)) *Application + func (a *Application) Usage(args []string) + func (a *Application) UsageForContext(context *ParseContext) error + func (a *Application) UsageForContextWithTemplate(context *ParseContext, indent int, tmpl string) error + func (a *Application) UsageTemplate(template string) *Application + func (a *Application) Validate(validator ApplicationValidator) *Application + func (a *Application) Version(version string) *Application + func (a *Application) Writer(w io.Writer) *Application + func (a Application) Arg(name, help string) *ArgClause + func (f Application) Flag(name, help string) *FlagClause + type ApplicationModel struct + Author string + Help string + Name string + Version string + type ApplicationValidator func(*Application) error + type ArgClause struct + func Arg(name, help string) *ArgClause + func (a *ArgClause) Action(action Action) *ArgClause + func (a *ArgClause) Default(value string) *ArgClause + func (a *ArgClause) Model() *ArgModel + func (a *ArgClause) PreAction(action Action) *ArgClause + func (a *ArgClause) Required() *ArgClause + func (p *ArgClause) Bool() (target *bool) + func (p *ArgClause) BoolList() (target *[]bool) + func (p *ArgClause) BoolListVar(target *[]bool) + func (p *ArgClause) BoolVar(target *bool) + func (p *ArgClause) Bytes() (target *units.Base2Bytes) + func (p *ArgClause) BytesVar(target *units.Base2Bytes) + func (p *ArgClause) Duration() (target *time.Duration) + func (p *ArgClause) DurationList() (target *[]time.Duration) + func (p *ArgClause) DurationListVar(target *[]time.Duration) + func (p *ArgClause) DurationVar(target *time.Duration) + func (p *ArgClause) Enum(options ...string) (target *string) + func (p *ArgClause) EnumVar(target *string, options ...string) + func (p *ArgClause) Enums(options ...string) (target *[]string) + func (p *ArgClause) EnumsVar(target *[]string, options ...string) + func (p *ArgClause) ExistingDir() (target *string) + func (p *ArgClause) ExistingDirVar(target *string) + func (p *ArgClause) ExistingDirs() (target *[]string) + func (p *ArgClause) ExistingDirsVar(target *[]string) + func (p *ArgClause) ExistingFile() (target *string) + func (p *ArgClause) ExistingFileOrDir() (target *string) + func (p *ArgClause) ExistingFileOrDirVar(target *string) + func (p *ArgClause) ExistingFileVar(target *string) + func (p *ArgClause) ExistingFiles() (target *[]string) + func (p *ArgClause) ExistingFilesOrDirs() (target *[]string) + func (p *ArgClause) ExistingFilesOrDirsVar(target *[]string) + func (p *ArgClause) ExistingFilesVar(target *[]string) + func (p *ArgClause) File() (target **os.File) + func (p *ArgClause) FileVar(target **os.File) + func (p *ArgClause) Float() (target *float64) + func (p *ArgClause) Float32() (target *float32) + func (p *ArgClause) Float32List() (target *[]float32) + func (p *ArgClause) Float32ListVar(target *[]float32) + func (p *ArgClause) Float32Var(target *float32) + func (p *ArgClause) Float64() (target *float64) + func (p *ArgClause) Float64List() (target *[]float64) + func (p *ArgClause) Float64ListVar(target *[]float64) + func (p *ArgClause) Float64Var(target *float64) + func (p *ArgClause) FloatVar(target *float64) + func (p *ArgClause) IP() (target *net.IP) + func (p *ArgClause) IPList() (target *[]net.IP) + func (p *ArgClause) IPListVar(target *[]net.IP) + func (p *ArgClause) IPVar(target *net.IP) + func (p *ArgClause) Int() (target *int) + func (p *ArgClause) Int16() (target *int16) + func (p *ArgClause) Int16List() (target *[]int16) + func (p *ArgClause) Int16ListVar(target *[]int16) + func (p *ArgClause) Int16Var(target *int16) + func (p *ArgClause) Int32() (target *int32) + func (p *ArgClause) Int32List() (target *[]int32) + func (p *ArgClause) Int32ListVar(target *[]int32) + func (p *ArgClause) Int32Var(target *int32) + func (p *ArgClause) Int64() (target *int64) + func (p *ArgClause) Int64List() (target *[]int64) + func (p *ArgClause) Int64ListVar(target *[]int64) + func (p *ArgClause) Int64Var(target *int64) + func (p *ArgClause) Int8() (target *int8) + func (p *ArgClause) Int8List() (target *[]int8) + func (p *ArgClause) Int8ListVar(target *[]int8) + func (p *ArgClause) Int8Var(target *int8) + func (p *ArgClause) IntVar(target *int) + func (p *ArgClause) Ints() (target *[]int) + func (p *ArgClause) IntsVar(target *[]int) + func (p *ArgClause) OpenFile(flag int, perm os.FileMode) (target **os.File) + func (p *ArgClause) OpenFileVar(target **os.File, flag int, perm os.FileMode) + func (p *ArgClause) SetValue(value Value) + func (p *ArgClause) String() (target *string) + func (p *ArgClause) StringMap() (target *map[string]string) + func (p *ArgClause) StringMapVar(target *map[string]string) + func (p *ArgClause) StringVar(target *string) + func (p *ArgClause) Strings() (target *[]string) + func (p *ArgClause) StringsVar(target *[]string) + func (p *ArgClause) TCP() (target **net.TCPAddr) + func (p *ArgClause) TCPList() (target *[]*net.TCPAddr) + func (p *ArgClause) TCPListVar(target *[]*net.TCPAddr) + func (p *ArgClause) TCPVar(target **net.TCPAddr) + func (p *ArgClause) URL() (target **url.URL) + func (p *ArgClause) URLList() (target *[]*url.URL) + func (p *ArgClause) URLListVar(target *[]*url.URL) + func (p *ArgClause) URLVar(target **url.URL) + func (p *ArgClause) Uint() (target *uint) + func (p *ArgClause) Uint16() (target *uint16) + func (p *ArgClause) Uint16List() (target *[]uint16) + func (p *ArgClause) Uint16ListVar(target *[]uint16) + func (p *ArgClause) Uint16Var(target *uint16) + func (p *ArgClause) Uint32() (target *uint32) + func (p *ArgClause) Uint32List() (target *[]uint32) + func (p *ArgClause) Uint32ListVar(target *[]uint32) + func (p *ArgClause) Uint32Var(target *uint32) + func (p *ArgClause) Uint64() (target *uint64) + func (p *ArgClause) Uint64List() (target *[]uint64) + func (p *ArgClause) Uint64ListVar(target *[]uint64) + func (p *ArgClause) Uint64Var(target *uint64) + func (p *ArgClause) Uint8() (target *uint8) + func (p *ArgClause) Uint8List() (target *[]uint8) + func (p *ArgClause) Uint8ListVar(target *[]uint8) + func (p *ArgClause) Uint8Var(target *uint8) + func (p *ArgClause) UintVar(target *uint) + func (p *ArgClause) Uints() (target *[]uint) + func (p *ArgClause) UintsVar(target *[]uint) + type ArgGroupModel struct + Args []*ArgModel + func (a *ArgGroupModel) ArgSummary() string + type ArgModel struct + Default string + Help string + Name string + Required bool + Value Value + func (a *ArgModel) String() string + type CmdClause struct + func Command(name, help string) *CmdClause + func (a CmdClause) Arg(name, help string) *ArgClause + func (c *CmdClause) Action(action Action) *CmdClause + func (c *CmdClause) Command(name, help string) *CmdClause + func (c *CmdClause) Default() *CmdClause + func (c *CmdClause) FullCommand() string + func (c *CmdClause) Hidden() *CmdClause + func (c *CmdClause) Model() *CmdModel + func (c *CmdClause) PreAction(action Action) *CmdClause + func (c *CmdClause) Validate(validator CmdClauseValidator) *CmdClause + func (f CmdClause) Flag(name, help string) *FlagClause + type CmdClauseValidator func(*CmdClause) error + type CmdGroupModel struct + Commands []*CmdModel + func (c *CmdGroupModel) FlattenedCommands() (out []*CmdModel) + type CmdModel struct + Default bool + Depth int + FullCommand string + Help string + Hidden bool + Name string + func (c *CmdModel) String() string + type FlagClause struct + func Flag(name, help string) *FlagClause + func (f *FlagClause) Action(action Action) *FlagClause + func (f *FlagClause) Bool() (target *bool) + func (f *FlagClause) Default(value string) *FlagClause + func (f *FlagClause) Hidden() *FlagClause + func (f *FlagClause) Model() *FlagModel + func (f *FlagClause) OverrideDefaultFromEnvar(envar string) *FlagClause + func (f *FlagClause) PlaceHolder(placeholder string) *FlagClause + func (f *FlagClause) PreAction(action Action) *FlagClause + func (f *FlagClause) Required() *FlagClause + func (f *FlagClause) Short(name byte) *FlagClause + func (p *FlagClause) BoolList() (target *[]bool) + func (p *FlagClause) BoolListVar(target *[]bool) + func (p *FlagClause) BoolVar(target *bool) + func (p *FlagClause) Bytes() (target *units.Base2Bytes) + func (p *FlagClause) BytesVar(target *units.Base2Bytes) + func (p *FlagClause) Duration() (target *time.Duration) + func (p *FlagClause) DurationList() (target *[]time.Duration) + func (p *FlagClause) DurationListVar(target *[]time.Duration) + func (p *FlagClause) DurationVar(target *time.Duration) + func (p *FlagClause) Enum(options ...string) (target *string) + func (p *FlagClause) EnumVar(target *string, options ...string) + func (p *FlagClause) Enums(options ...string) (target *[]string) + func (p *FlagClause) EnumsVar(target *[]string, options ...string) + func (p *FlagClause) ExistingDir() (target *string) + func (p *FlagClause) ExistingDirVar(target *string) + func (p *FlagClause) ExistingDirs() (target *[]string) + func (p *FlagClause) ExistingDirsVar(target *[]string) + func (p *FlagClause) ExistingFile() (target *string) + func (p *FlagClause) ExistingFileOrDir() (target *string) + func (p *FlagClause) ExistingFileOrDirVar(target *string) + func (p *FlagClause) ExistingFileVar(target *string) + func (p *FlagClause) ExistingFiles() (target *[]string) + func (p *FlagClause) ExistingFilesOrDirs() (target *[]string) + func (p *FlagClause) ExistingFilesOrDirsVar(target *[]string) + func (p *FlagClause) ExistingFilesVar(target *[]string) + func (p *FlagClause) File() (target **os.File) + func (p *FlagClause) FileVar(target **os.File) + func (p *FlagClause) Float() (target *float64) + func (p *FlagClause) Float32() (target *float32) + func (p *FlagClause) Float32List() (target *[]float32) + func (p *FlagClause) Float32ListVar(target *[]float32) + func (p *FlagClause) Float32Var(target *float32) + func (p *FlagClause) Float64() (target *float64) + func (p *FlagClause) Float64List() (target *[]float64) + func (p *FlagClause) Float64ListVar(target *[]float64) + func (p *FlagClause) Float64Var(target *float64) + func (p *FlagClause) FloatVar(target *float64) + func (p *FlagClause) IP() (target *net.IP) + func (p *FlagClause) IPList() (target *[]net.IP) + func (p *FlagClause) IPListVar(target *[]net.IP) + func (p *FlagClause) IPVar(target *net.IP) + func (p *FlagClause) Int() (target *int) + func (p *FlagClause) Int16() (target *int16) + func (p *FlagClause) Int16List() (target *[]int16) + func (p *FlagClause) Int16ListVar(target *[]int16) + func (p *FlagClause) Int16Var(target *int16) + func (p *FlagClause) Int32() (target *int32) + func (p *FlagClause) Int32List() (target *[]int32) + func (p *FlagClause) Int32ListVar(target *[]int32) + func (p *FlagClause) Int32Var(target *int32) + func (p *FlagClause) Int64() (target *int64) + func (p *FlagClause) Int64List() (target *[]int64) + func (p *FlagClause) Int64ListVar(target *[]int64) + func (p *FlagClause) Int64Var(target *int64) + func (p *FlagClause) Int8() (target *int8) + func (p *FlagClause) Int8List() (target *[]int8) + func (p *FlagClause) Int8ListVar(target *[]int8) + func (p *FlagClause) Int8Var(target *int8) + func (p *FlagClause) IntVar(target *int) + func (p *FlagClause) Ints() (target *[]int) + func (p *FlagClause) IntsVar(target *[]int) + func (p *FlagClause) OpenFile(flag int, perm os.FileMode) (target **os.File) + func (p *FlagClause) OpenFileVar(target **os.File, flag int, perm os.FileMode) + func (p *FlagClause) SetValue(value Value) + func (p *FlagClause) String() (target *string) + func (p *FlagClause) StringMap() (target *map[string]string) + func (p *FlagClause) StringMapVar(target *map[string]string) + func (p *FlagClause) StringVar(target *string) + func (p *FlagClause) Strings() (target *[]string) + func (p *FlagClause) StringsVar(target *[]string) + func (p *FlagClause) TCP() (target **net.TCPAddr) + func (p *FlagClause) TCPList() (target *[]*net.TCPAddr) + func (p *FlagClause) TCPListVar(target *[]*net.TCPAddr) + func (p *FlagClause) TCPVar(target **net.TCPAddr) + func (p *FlagClause) URL() (target **url.URL) + func (p *FlagClause) URLList() (target *[]*url.URL) + func (p *FlagClause) URLListVar(target *[]*url.URL) + func (p *FlagClause) URLVar(target **url.URL) + func (p *FlagClause) Uint() (target *uint) + func (p *FlagClause) Uint16() (target *uint16) + func (p *FlagClause) Uint16List() (target *[]uint16) + func (p *FlagClause) Uint16ListVar(target *[]uint16) + func (p *FlagClause) Uint16Var(target *uint16) + func (p *FlagClause) Uint32() (target *uint32) + func (p *FlagClause) Uint32List() (target *[]uint32) + func (p *FlagClause) Uint32ListVar(target *[]uint32) + func (p *FlagClause) Uint32Var(target *uint32) + func (p *FlagClause) Uint64() (target *uint64) + func (p *FlagClause) Uint64List() (target *[]uint64) + func (p *FlagClause) Uint64ListVar(target *[]uint64) + func (p *FlagClause) Uint64Var(target *uint64) + func (p *FlagClause) Uint8() (target *uint8) + func (p *FlagClause) Uint8List() (target *[]uint8) + func (p *FlagClause) Uint8ListVar(target *[]uint8) + func (p *FlagClause) Uint8Var(target *uint8) + func (p *FlagClause) UintVar(target *uint) + func (p *FlagClause) Uints() (target *[]uint) + func (p *FlagClause) UintsVar(target *[]uint) + type FlagGroupModel struct + Flags []*FlagModel + func (f *FlagGroupModel) FlagSummary() string + type FlagModel struct + Default string + Envar string + Help string + Hidden bool + Name string + PlaceHolder string + Required bool + Short rune + Value Value + func (f *FlagModel) FormatPlaceHolder() string + func (f *FlagModel) IsBoolFlag() bool + func (f *FlagModel) String() string + type Getter interface + Get func() interface{} + type ParseContext struct + Elements []*ParseElement + SelectedCommand *CmdClause + func (p *ParseContext) EOL() bool + func (p *ParseContext) HasTrailingArgs() bool + func (p *ParseContext) Next() *Token + func (p *ParseContext) Peek() *Token + func (p *ParseContext) Push(token *Token) *Token + func (p *ParseContext) String() string + type ParseElement struct + Clause interface{} + Value *string + type Settings interface + SetValue func(value Value) + type Token struct + Index int + Type TokenType + Value string + func (t *Token) Equal(o *Token) bool + func (t *Token) IsEOF() bool + func (t *Token) IsFlag() bool + func (t *Token) String() string + type TokenType int + const TokenArg + const TokenEOL + const TokenError + const TokenLong + const TokenShort + func (t TokenType) String() string + type Value interface + Set func(string) error + String func() string