change "complete" to "shellComplete"
This commit is contained in:
parent
ea3df26e64
commit
8dd1962f7b
4
app.go
4
app.go
@ -175,7 +175,7 @@ func (a *App) Run(arguments []string) (err error) {
|
|||||||
// flag name as the value of the flag before it which is undesirable
|
// flag name as the value of the flag before it which is undesirable
|
||||||
// note that we can only do this because the shell autocomplete function
|
// note that we can only do this because the shell autocomplete function
|
||||||
// always appends the completion flag at the end of the command
|
// always appends the completion flag at the end of the command
|
||||||
complete, arguments := checkCompleteFlag(a, arguments)
|
shellComplete, arguments := checkShellCompleteFlag(a, arguments)
|
||||||
|
|
||||||
// parse flags
|
// parse flags
|
||||||
set := flagSet(a.Name, a.Flags)
|
set := flagSet(a.Name, a.Flags)
|
||||||
@ -188,7 +188,7 @@ func (a *App) Run(arguments []string) (err error) {
|
|||||||
ShowAppHelp(context)
|
ShowAppHelp(context)
|
||||||
return nerr
|
return nerr
|
||||||
}
|
}
|
||||||
context.complete = complete
|
context.shellComplete = shellComplete
|
||||||
|
|
||||||
if checkCompletions(context) {
|
if checkCompletions(context) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
type Context struct {
|
type Context struct {
|
||||||
App *App
|
App *App
|
||||||
Command Command
|
Command Command
|
||||||
complete bool
|
shellComplete bool
|
||||||
flagSet *flag.FlagSet
|
flagSet *flag.FlagSet
|
||||||
setFlags map[string]bool
|
setFlags map[string]bool
|
||||||
parentContext *Context
|
parentContext *Context
|
||||||
@ -26,7 +26,7 @@ func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
|
|||||||
c := &Context{App: app, flagSet: set, parentContext: parentCtx}
|
c := &Context{App: app, flagSet: set, parentContext: parentCtx}
|
||||||
|
|
||||||
if parentCtx != nil {
|
if parentCtx != nil {
|
||||||
c.complete = parentCtx.complete
|
c.shellComplete = parentCtx.shellComplete
|
||||||
}
|
}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
6
help.go
6
help.go
@ -252,7 +252,7 @@ func checkSubcommandHelp(c *Context) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkCompleteFlag(a *App, arguments []string) (bool, []string) {
|
func checkShellCompleteFlag(a *App, arguments []string) (bool, []string) {
|
||||||
if !a.EnableBashCompletion {
|
if !a.EnableBashCompletion {
|
||||||
return false, arguments
|
return false, arguments
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ func checkCompleteFlag(a *App, arguments []string) (bool, []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkCompletions(c *Context) bool {
|
func checkCompletions(c *Context) bool {
|
||||||
if !c.complete {
|
if !c.shellComplete {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ func checkCompletions(c *Context) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkCommandCompletions(c *Context, name string) bool {
|
func checkCommandCompletions(c *Context, name string) bool {
|
||||||
if !c.complete {
|
if !c.shellComplete {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user