diff --git a/app_test.go b/app_test.go index f329b91..4e94f9e 100644 --- a/app_test.go +++ b/app_test.go @@ -24,6 +24,40 @@ func ExampleApp() { // Hello Jeremy } +func ExampleAppHelp() { + // set args for examples sake + os.Args = []string{"greet", "h", "describeit"} + + app := cli.NewApp() + app.Name = "greet" + app.Flags = []cli.Flag{ + cli.StringFlag{Name: "name", Value: "bob", Usage: "a name to say"}, + } + app.Commands = []cli.Command{ + { + Name: "describeit", + ShortName: "d", + Usage: "use it to see a description", + Description: "This is how we describe describeit the function", + Action: func(c *cli.Context) { + fmt.Printf("i like to describe things") + }, + }, + } + app.Run(os.Args) + // Output: + // NAME: + // describeit - use it to see a description + // + // USAGE: + // command describeit [command options] [arguments...] + // + // DESCRIPTION: + // This is how we describe describeit the function + // + // OPTIONS: +} + func TestApp_Run(t *testing.T) { s := ""