Documentation
¶
Index ¶
- Constants
- type Action
- type ActionNative
- type ActionNativeDocopt
- type ActionNativeSimple
- type ActionNormal
- type ActionResult
- type ActionSimple
- type Commander
- type Context
- type DocoptMap
- func (d DocoptMap) Contain(key string) bool
- func (d DocoptMap) Get(key string) interface{}
- func (d DocoptMap) GetBool(key string) (bool, bool)
- func (d DocoptMap) GetFloat(key string) (float32, bool)
- func (d DocoptMap) GetFloat64(key string) (float64, bool)
- func (d DocoptMap) GetInt(key string) (int, bool)
- func (d DocoptMap) GetInt64(key string) (int64, bool)
- func (d DocoptMap) GetString(key string) (string, bool)
- func (d DocoptMap) GetStrings(key string) ([]string, bool)
- func (d DocoptMap) Map() map[string]interface{}
- func (d DocoptMap) MustBool(key string) bool
- func (d DocoptMap) MustFloat(key string) float32
- func (d DocoptMap) MustFloat64(key string) float64
- func (d DocoptMap) MustInt(key string) int
- func (d DocoptMap) MustInt64(key string) int64
- func (d DocoptMap) MustString(key string) string
- func (d DocoptMap) MustStrings(key string) []string
- type GoCommander
Constants ¶
View Source
const DEBUG bool = false
const DEBUG bool = true
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action func(c Context) _Result // default internal function
The following are ACTION functions, chose one if you like it.
type ActionNative ¶ added in v0.7.0
type ActionNative func()
The following are ACTION functions, chose one if you like it.
type ActionNativeDocopt ¶ added in v0.7.1
The following are ACTION functions, chose one if you like it.
type ActionNativeSimple ¶ added in v0.7.1
type ActionNativeSimple func() error
The following are ACTION functions, chose one if you like it.
type ActionNormal ¶ added in v0.7.0
The following are ACTION functions, chose one if you like it.
type ActionResult ¶ added in v0.14.0
type ActionResult func() _Result
The following are ACTION functions, chose one if you like it.
type ActionSimple ¶ added in v0.7.0
type ActionSimple func(c Context)
The following are ACTION functions, chose one if you like it.
type Commander ¶
type Commander interface {
Doc(doc string) Commander
Version(ver string) Commander
ShowVersion() string
Description(desc string) Commander
Annotation(title string, contents []string) Commander
Command(usage string, args ...interface{}) Commander
Aliases(aliases []string) Commander
Option(usage string, args ...interface{}) Commander
Action(action interface{}, keys ...[]string) Commander
HelpMessage() string
ShowHelpMessage() string
Parse(argv ...[]string) (Context, error)
}
Commander Command line implementation
type Context ¶
type Context interface {
// _Argv
GetArg(index int) string
GetArgs(offsets ...int) []string
ArgsString() string
ArgsStringSeparator(sep string, offsets ...int) string
// DocoptMap
Map() map[string]interface{}
Get(key string) interface{}
Contain(key string) bool
GetString(key string) (string, bool)
MustString(key string) string
GetStrings(key string) ([]string, bool)
MustStrings(key string) []string
GetBool(key string) (bool, bool)
MustBool(key string) bool
GetInt64(key string) (int64, bool)
MustInt64(key string) int64
GetInt(key string) (int, bool)
MustInt(key string) int
GetFloat64(key string) (float64, bool)
MustFloat64(key string) float64
GetFloat(key string) (float32, bool)
MustFloat(key string) float32
}
type DocoptMap ¶
type DocoptMap map[string]interface{}
DocoptMap docopt returns a map of option names to the values
func (DocoptMap) MustFloat64 ¶ added in v0.16.0
func (DocoptMap) MustString ¶ added in v0.16.0
func (DocoptMap) MustStrings ¶ added in v0.16.0
type GoCommander ¶ added in v0.7.1
var Program GoCommander = newProgram()
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
calculator_example
command
|
|
|
counted_example
command
|
|
|
naval_fate
command
|
|
|
quick_example
command
|
Click to show internal directories.
Click to hide internal directories.