make shell autocomplete more robust
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
type Context struct {
|
||||
App *App
|
||||
Command Command
|
||||
complete bool
|
||||
flagSet *flag.FlagSet
|
||||
setFlags map[string]bool
|
||||
parentContext *Context
|
||||
@@ -22,7 +23,13 @@ type Context struct {
|
||||
|
||||
// NewContext creates a new context. For use in when invoking an App or Command action.
|
||||
func NewContext(app *App, set *flag.FlagSet, parentCtx *Context) *Context {
|
||||
return &Context{App: app, flagSet: set, parentContext: parentCtx}
|
||||
c := &Context{App: app, flagSet: set, parentContext: parentCtx}
|
||||
|
||||
if parentCtx != nil {
|
||||
c.complete = parentCtx.complete
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
// NumFlags returns the number of flags set
|
||||
|
Reference in New Issue
Block a user