|
|
@ -24,6 +24,40 @@ func ExampleApp() {
|
|
|
|
// Hello Jeremy
|
|
|
|
// 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) {
|
|
|
|
func TestApp_Run(t *testing.T) {
|
|
|
|
s := ""
|
|
|
|
s := ""
|
|
|
|
|
|
|
|
|
|
|
|