merging code
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user