TUN-3963: Repoint urfave/cli/v2 library at patched branch at github.com/ipostelnik/cli/v2@fixed which correctly handles reading flags declared at multiple levels of subcommands.

This commit is contained in:
Igor Postelnik
2021-02-23 13:48:32 -06:00
parent 792520d313
commit 6db934853d
40 changed files with 380 additions and 308 deletions

View File

@@ -68,7 +68,7 @@ func (f *GenericFlag) GetValue() string {
// Apply takes the flagset and calls Set on the generic flag with the value
// provided by the user for parsing by the flag
func (f GenericFlag) Apply(set *flag.FlagSet) error {
func (f *GenericFlag) Apply(set *flag.FlagSet) error {
if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok {
if val != "" {
if err := f.Value.Set(val); err != nil {
@@ -89,14 +89,10 @@ func (f GenericFlag) Apply(set *flag.FlagSet) error {
// Generic looks up the value of a local GenericFlag, returns
// nil if not found
func (c *Context) Generic(name string) interface{} {
if fs := lookupFlagSet(name, c); fs != nil {
return lookupGeneric(name, fs)
}
return nil
return lookupGeneric(c.resolveFlagDeep(name))
}
func lookupGeneric(name string, set *flag.FlagSet) interface{} {
f := set.Lookup(name)
func lookupGeneric(f *flag.Flag) interface{} {
if f != nil {
parsed, err := f.Value, error(nil)
if err != nil {