fix doc tests

This commit is contained in:
Lynn Cyrin 2019-12-24 09:34:31 -08:00
parent 35510ee0f9
commit c806e29aa5
No known key found for this signature in database
GPG Key ID: 9E60BEE0555C367B

View File

@ -1402,13 +1402,15 @@ func main() {
cli.ShowVersion(c) cli.ShowVersion(c)
fmt.Printf("%#v\n", c.App.Command("doo")) fmt.Printf("%#v\n", c.App.Command("doo"))
if c.Bool("infinite") { // // uncomment when https://github.com/urfave/cli/pull/1014 is released
c.App.Run([]string{"app", "doo", "wop"}) // if c.Bool("infinite") {
} // 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())
@ -1424,28 +1426,29 @@ 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)
fmt.Printf("%#v\n", nc.Args()) // // uncomment when https://github.com/urfave/cli/pull/1014 is released
fmt.Printf("%#v\n", nc.Bool("nope")) // fmt.Printf("%#v\n", nc.Args())
fmt.Printf("%#v\n", !nc.Bool("nerp")) // fmt.Printf("%#v\n", nc.Bool("nope"))
fmt.Printf("%#v\n", nc.Duration("howlong")) // fmt.Printf("%#v\n", !nc.Bool("nerp"))
fmt.Printf("%#v\n", nc.Float64("hay")) // fmt.Printf("%#v\n", nc.Duration("howlong"))
fmt.Printf("%#v\n", nc.Generic("bloop")) // fmt.Printf("%#v\n", nc.Float64("hay"))
fmt.Printf("%#v\n", nc.Int64("bonk")) // fmt.Printf("%#v\n", nc.Generic("bloop"))
fmt.Printf("%#v\n", nc.Int64Slice("burnks")) // fmt.Printf("%#v\n", nc.Int64("bonk"))
fmt.Printf("%#v\n", nc.Int("bips")) // fmt.Printf("%#v\n", nc.Int64Slice("burnks"))
fmt.Printf("%#v\n", nc.IntSlice("blups")) // fmt.Printf("%#v\n", nc.Int("bips"))
fmt.Printf("%#v\n", nc.String("snurt")) // fmt.Printf("%#v\n", nc.IntSlice("blups"))
fmt.Printf("%#v\n", nc.StringSlice("snurkles")) // fmt.Printf("%#v\n", nc.String("snurt"))
fmt.Printf("%#v\n", nc.Uint("flub")) // fmt.Printf("%#v\n", nc.StringSlice("snurkles"))
fmt.Printf("%#v\n", nc.Uint64("florb")) // fmt.Printf("%#v\n", nc.Uint("flub"))
// fmt.Printf("%#v\n", nc.Uint64("florb"))
fmt.Printf("%#v\n", nc.FlagNames())
fmt.Printf("%#v\n", nc.IsSet("wat"))
fmt.Printf("%#v\n", nc.Set("wat", "nope"))
fmt.Printf("%#v\n", nc.NArg())
fmt.Printf("%#v\n", nc.NumFlags())
fmt.Printf("%#v\n", nc.Lineage()[1])
// // uncomment when https://github.com/urfave/cli/pull/1014 is released
// fmt.Printf("%#v\n", nc.FlagNames())
// fmt.Printf("%#v\n", nc.IsSet("wat"))
// fmt.Printf("%#v\n", nc.Set("wat", "nope"))
// fmt.Printf("%#v\n", nc.NArg())
// 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)