Documentation
¶
Index ¶
- Constants
- type AliasFlag
- type Climate
- func (cl Climate) Abort(message string, err error, options ...interface{})
- func (cl *Climate) AddAlias(resolved_name, alias string)
- func (cl *Climate) AddFlag(flag clasp.Alias, flags ...AliasFlag)
- func (cl *Climate) AddFlagFunc(flag clasp.Alias, flagFn FlagFunc, flags ...AliasFlag)
- func (cl *Climate) AddOption(option clasp.Alias, flags ...AliasFlag)
- func (cl *Climate) AddOptionFunc(option clasp.Alias, optionFn OptionFunc, flags ...AliasFlag)
- func (cl Climate) Parse(argv []string, options ...interface{}) (result Result, err error)
- func (cl Climate) ParseAndVerify(argv []string, options ...interface{}) (result Result, err error)
- type FlagFunc
- type InitFlag
- type InitFunc
- type OptionFunc
- type ParseFlag
- type Result
Constants ¶
const ( VersionMajor int16 = 0 VersionMinor int16 = 5 VersionPatch int16 = 0 Version int64 = (int64(VersionMajor) << 48) + (int64(VersionMinor) << 32) + (int64(VersionPatch) << 16) VersionRevision int16 = VersionPatch )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliasFlag ¶
type AliasFlag int
Type of flags passed to the libclimate.AddFlag(), and libclimate.AddOption() methods
type Climate ¶
type Climate struct {
Aliases []*clasp.Alias
ParseFlags clasp.ParseFlag
Version interface{}
VersionPrefix string
InfoLines []string
ProgramName string
// contains filtered or unexported fields
}
Structure representing a CLI parsing context, obtained from libclimate.Init()
func Init ¶
Initialises a Climate instance, according to the given function (which may not be nil) and arguments
func (Climate) Abort ¶ added in v0.3.0
Emits the given message and, optionally, err to the standard error stream, prefixed with the program name, and then terminates the process with a non-0 exit code.
func (*Climate) AddAlias ¶
Adds an alias to the Climate instance
The resolved_name param can be the name of a flag or option, or an option-with-value. The alias param is the alias (which must not contain an equals sign.
func (*Climate) AddFlagFunc ¶ added in v0.2.0
Adds a (copy of the) flag to the Climate instance
func (*Climate) AddOptionFunc ¶ added in v0.2.0
func (cl *Climate) AddOptionFunc(option clasp.Alias, optionFn OptionFunc, flags ...AliasFlag)
Adds a (copy of the) option to the Climate instance
type Result ¶
type Result struct {
Flags []*clasp.Argument
Options []*clasp.Argument
Values []*clasp.Argument
ProgramName string
Argv []string
// contains filtered or unexported fields
}
Structure representing CLI results, obtained from Climate.Parse()
func (Result) FlagIsSpecified ¶
Determines if the given flag is specified
func (Result) LookupFlag ¶ added in v0.2.0
Looks for a flag with the given id - name, or the alias instance - and returns it and the value true if found; if not, returns nil and false
func (Result) LookupOption ¶
Looks for an option with the given id - name, or the alias instance - and returns it and the value true if found; if not, returns nil and false