Merge pull request #9 from codegangsta/JMS-2
Renamed DefaultAction to Action. Renamed cli.Action type to cli.Handler
This commit is contained in:
commit
598fb195c2
10
cli.go
10
cli.go
@ -18,7 +18,7 @@ var Commands []Command
|
|||||||
var Flags []Flag
|
var Flags []Flag
|
||||||
|
|
||||||
// The action to execute when no subcommands are specified
|
// The action to execute when no subcommands are specified
|
||||||
var DefaultAction = ShowHelp
|
var Action = ShowHelp
|
||||||
|
|
||||||
func Run(args []string) {
|
func Run(args []string) {
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
@ -32,7 +32,7 @@ func Run(args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run default Action
|
// Run default Action
|
||||||
DefaultAction("")
|
Action("")
|
||||||
}
|
}
|
||||||
|
|
||||||
type Command struct {
|
type Command struct {
|
||||||
@ -40,8 +40,8 @@ type Command struct {
|
|||||||
ShortName string
|
ShortName string
|
||||||
Usage string
|
Usage string
|
||||||
Description string
|
Description string
|
||||||
Action Action
|
Action Handler
|
||||||
Flags flag.FlagSet
|
Flags flag.FlagSet
|
||||||
}
|
}
|
||||||
|
|
||||||
type Action func(name string)
|
type Handler func(name string)
|
||||||
|
Loading…
Reference in New Issue
Block a user