|
|
|
@ -10,9 +10,19 @@ type Command struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c Command) Run(ctx *Context) {
|
|
|
|
|
// append help to flags
|
|
|
|
|
c.Flags = append(
|
|
|
|
|
c.Flags,
|
|
|
|
|
helpFlag{"show help"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set := flagSet(c.Name, c.Flags)
|
|
|
|
|
set.Parse(ctx.Args()[1:])
|
|
|
|
|
c.Action(NewContext(ctx.App, set, ctx.globalSet))
|
|
|
|
|
|
|
|
|
|
context := NewContext(ctx.App, set, ctx.globalSet)
|
|
|
|
|
checkCommandHelp(context, c.Name)
|
|
|
|
|
|
|
|
|
|
c.Action(context)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c Command) HasName(name string) bool {
|
|
|
|
|