merging code

This commit is contained in:
Summer Mousa
2014-04-10 12:14:13 -05:00
parent 3fa24ca4f3
commit 0b29bee364
3 changed files with 49 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ type Command struct {
Usage string
// A longer explaination of how the command works
Description string
// The function to call when checking for bash command completions
BashComplete func(context *Context)
// The function to call when this command is invoked
Action func(context *Context)
// List of flags to parse
@@ -27,6 +29,7 @@ func (c Command) Run(ctx *Context) error {
// append help to flags
c.Flags = append(
c.Flags,
BoolFlag{"generate-bash-completion", ""},
BoolFlag{"help, h", "show help"},
)
@@ -67,6 +70,11 @@ func (c Command) Run(ctx *Context) error {
return nerr
}
context := NewContext(ctx.App, set, ctx.globalSet)
if checkCommandCompletions(context, c.Name) {
return nil
}
if checkCommandHelp(context, c.Name) {
return nil
}