Files
urfave-cli/command.go
T

21 lines
403 B
Go
Raw Normal View History

package cli
type Command struct {
Name string
ShortName string
Usage string
Description string
Action Handler
Flags []Flag
}
2013-07-18 19:23:00 -07:00
2013-07-20 08:21:20 -07:00
func (c Command) Run(ctx *Context) {
set := flagSet(c.Name, c.Flags)
set.Parse(ctx.Args()[1:])
c.Action(NewContext(ctx.App, set, ctx.globalSet))
2013-07-18 19:23:00 -07:00
}
2013-07-18 19:30:18 -07:00
2013-07-20 08:21:20 -07:00
func (c Command) HasName(name string) bool {
return c.Name == name || c.ShortName == name
2013-07-18 19:30:18 -07:00
}