Merge branch 'master' into patch-1

main
Martin Lees 5 years ago committed by GitHub
commit 3f80cc798f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,9 +32,13 @@ A clear and concise description of what the bug is.
Describe the steps or code required to reproduce the behavior Describe the steps or code required to reproduce the behavior
## Observed behavior
What did you see happen immediately after the reproduction steps above?
## Expected behavior ## Expected behavior
A clear and concise description of what you expected to happen. What would you have expected to happen immediately after the reproduction steps above?
## Additional context ## Additional context

@ -32,9 +32,13 @@ A clear and concise description of what the bug is.
Describe the steps or code required to reproduce the behavior Describe the steps or code required to reproduce the behavior
## Observed behavior
What did you see happen immediately after the reproduction steps above?
## Expected behavior ## Expected behavior
A clear and concise description of what you expected to happen. What would you have expected to happen immediately after the reproduction steps above?
## Additional context ## Additional context

@ -1505,15 +1505,13 @@ func main() {
cli.ShowVersion(c) cli.ShowVersion(c)
fmt.Printf("%#v\n", c.App.Command("doo")) fmt.Printf("%#v\n", c.App.Command("doo"))
// // uncomment when https://github.com/urfave/cli/pull/1014 is released if c.Bool("infinite") {
// if c.Bool("infinite") { c.App.Run([]string{"app", "doo", "wop"})
// c.App.Run([]string{"app", "doo", "wop"}) }
// }
if c.Bool("forevar") {
// // uncomment when https://github.com/urfave/cli/pull/1014 is released c.App.RunAsSubcommand(c)
// if c.Bool("forevar") { }
// c.App.RunAsSubcommand(c)
// }
c.App.Setup() c.App.Setup()
fmt.Printf("%#v\n", c.App.VisibleCategories()) fmt.Printf("%#v\n", c.App.VisibleCategories())
fmt.Printf("%#v\n", c.App.VisibleCommands()) fmt.Printf("%#v\n", c.App.VisibleCommands())
@ -1529,29 +1527,27 @@ func main() {
set := flag.NewFlagSet("contrive", 0) set := flag.NewFlagSet("contrive", 0)
nc := cli.NewContext(c.App, set, c) nc := cli.NewContext(c.App, set, c)
// // uncomment when https://github.com/urfave/cli/pull/1014 is released fmt.Printf("%#v\n", nc.Args())
// fmt.Printf("%#v\n", nc.Args()) fmt.Printf("%#v\n", nc.Bool("nope"))
// fmt.Printf("%#v\n", nc.Bool("nope")) fmt.Printf("%#v\n", !nc.Bool("nerp"))
// fmt.Printf("%#v\n", !nc.Bool("nerp")) fmt.Printf("%#v\n", nc.Duration("howlong"))
// fmt.Printf("%#v\n", nc.Duration("howlong")) fmt.Printf("%#v\n", nc.Float64("hay"))
// fmt.Printf("%#v\n", nc.Float64("hay")) fmt.Printf("%#v\n", nc.Generic("bloop"))
// fmt.Printf("%#v\n", nc.Generic("bloop")) fmt.Printf("%#v\n", nc.Int64("bonk"))
// fmt.Printf("%#v\n", nc.Int64("bonk")) fmt.Printf("%#v\n", nc.Int64Slice("burnks"))
// fmt.Printf("%#v\n", nc.Int64Slice("burnks")) fmt.Printf("%#v\n", nc.Int("bips"))
// fmt.Printf("%#v\n", nc.Int("bips")) fmt.Printf("%#v\n", nc.IntSlice("blups"))
// fmt.Printf("%#v\n", nc.IntSlice("blups")) fmt.Printf("%#v\n", nc.String("snurt"))
// fmt.Printf("%#v\n", nc.String("snurt")) fmt.Printf("%#v\n", nc.StringSlice("snurkles"))
// fmt.Printf("%#v\n", nc.StringSlice("snurkles")) fmt.Printf("%#v\n", nc.Uint("flub"))
// fmt.Printf("%#v\n", nc.Uint("flub")) fmt.Printf("%#v\n", nc.Uint64("florb"))
// fmt.Printf("%#v\n", nc.Uint64("florb"))
fmt.Printf("%#v\n", nc.FlagNames())
// // uncomment when https://github.com/urfave/cli/pull/1014 is released fmt.Printf("%#v\n", nc.IsSet("wat"))
// fmt.Printf("%#v\n", nc.FlagNames()) fmt.Printf("%#v\n", nc.Set("wat", "nope"))
// fmt.Printf("%#v\n", nc.IsSet("wat")) fmt.Printf("%#v\n", nc.NArg())
// fmt.Printf("%#v\n", nc.Set("wat", "nope")) fmt.Printf("%#v\n", nc.NumFlags())
// fmt.Printf("%#v\n", nc.NArg()) fmt.Printf("%#v\n", nc.Lineage()[1])
// fmt.Printf("%#v\n", nc.NumFlags())
// fmt.Printf("%#v\n", nc.Lineage()[1])
nc.Set("wat", "also-nope") nc.Set("wat", "also-nope")
ec := cli.Exit("ohwell", 86) ec := cli.Exit("ohwell", 86)

@ -261,19 +261,19 @@ func flagValue(f Flag) reflect.Value {
func stringifyFlag(f Flag) string { func stringifyFlag(f Flag) string {
fv := flagValue(f) fv := flagValue(f)
switch f.(type) { switch f := f.(type) {
case *IntSliceFlag: case *IntSliceFlag:
return withEnvHint(flagStringSliceField(f, "EnvVars"), return withEnvHint(flagStringSliceField(f, "EnvVars"),
stringifyIntSliceFlag(f.(*IntSliceFlag))) stringifyIntSliceFlag(f))
case *Int64SliceFlag: case *Int64SliceFlag:
return withEnvHint(flagStringSliceField(f, "EnvVars"), return withEnvHint(flagStringSliceField(f, "EnvVars"),
stringifyInt64SliceFlag(f.(*Int64SliceFlag))) stringifyInt64SliceFlag(f))
case *Float64SliceFlag: case *Float64SliceFlag:
return withEnvHint(flagStringSliceField(f, "EnvVars"), return withEnvHint(flagStringSliceField(f, "EnvVars"),
stringifyFloat64SliceFlag(f.(*Float64SliceFlag))) stringifyFloat64SliceFlag(f))
case *StringSliceFlag: case *StringSliceFlag:
return withEnvHint(flagStringSliceField(f, "EnvVars"), return withEnvHint(flagStringSliceField(f, "EnvVars"),
stringifyStringSliceFlag(f.(*StringSliceFlag))) stringifyStringSliceFlag(f))
} }
placeholder, usage := unquoteUsage(fv.FieldByName("Usage").String()) placeholder, usage := unquoteUsage(fv.FieldByName("Usage").String())

Loading…
Cancel
Save