TUN-3964: Revert "TUN-3922: 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 reverts commit 1670ee87fb.
This commit is contained in:
cthuang
2021-02-23 12:23:57 +00:00
committed by Chung Ting Huang
parent e9c2afec56
commit 9d5bd256be
37 changed files with 274 additions and 307 deletions

View File

@@ -86,10 +86,14 @@ func (f *DurationFlag) Apply(set *flag.FlagSet) error {
// Duration looks up the value of a local DurationFlag, returns
// 0 if not found
func (c *Context) Duration(name string) time.Duration {
return lookupDuration(c.resolveFlagDeep(name))
if fs := lookupFlagSet(name, c); fs != nil {
return lookupDuration(name, fs)
}
return 0
}
func lookupDuration(f *flag.Flag) time.Duration {
func lookupDuration(name string, set *flag.FlagSet) time.Duration {
f := set.Lookup(name)
if f != nil {
parsed, err := time.ParseDuration(f.Value.String())
if err != nil {