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