diff --git a/.travis.yml b/.travis.yml index b08641d..87ba52f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,11 @@ go: - 1.3.3 - 1.4.2 - 1.5.1 +- tip + +matrix: + allow_failures: + - go: tip script: - go vet ./... diff --git a/app_test.go b/app_test.go index ada5d69..28d8e0f 100644 --- a/app_test.go +++ b/app_test.go @@ -10,7 +10,7 @@ import ( "testing" ) -func ExampleApp() { +func ExampleApp_Run() { // set args for examples sake os.Args = []string{"greet", "--name", "Jeremy"} @@ -30,7 +30,7 @@ func ExampleApp() { // Hello Jeremy } -func ExampleAppSubcommand() { +func ExampleApp_Run_subcommand() { // set args for examples sake os.Args = []string{"say", "hi", "english", "--name", "Jeremy"} app := NewApp() @@ -67,7 +67,7 @@ func ExampleAppSubcommand() { // Hello, Jeremy } -func ExampleAppHelp() { +func ExampleApp_Run_help() { // set args for examples sake os.Args = []string{"greet", "h", "describeit"} @@ -99,7 +99,7 @@ func ExampleAppHelp() { // This is how we describe describeit the function } -func ExampleAppBashComplete() { +func ExampleApp_Run_bashComplete() { // set args for examples sake os.Args = []string{"greet", "--generate-bash-completion"} diff --git a/cli_test.go b/cli_test.go deleted file mode 100644 index e54f8e2..0000000 --- a/cli_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package cli - -import ( - "os" -) - -func Example() { - app := NewApp() - app.Name = "todo" - app.Usage = "task list on the command line" - app.Commands = []Command{ - { - Name: "add", - Aliases: []string{"a"}, - Usage: "add a task to the list", - Action: func(c *Context) { - println("added task: ", c.Args().First()) - }, - }, - { - Name: "complete", - Aliases: []string{"c"}, - Usage: "complete a task on the list", - Action: func(c *Context) { - println("completed task: ", c.Args().First()) - }, - }, - } - - app.Run(os.Args) -} - -func ExampleSubcommand() { - app := NewApp() - app.Name = "say" - app.Commands = []Command{ - { - Name: "hello", - Aliases: []string{"hi"}, - Usage: "use it to see a description", - Description: "This is how we describe hello the function", - Subcommands: []Command{ - { - Name: "english", - Aliases: []string{"en"}, - Usage: "sends a greeting in english", - Description: "greets someone in english", - Flags: []Flag{ - StringFlag{ - Name: "name", - Value: "Bob", - Usage: "Name of the person to greet", - }, - }, - Action: func(c *Context) { - println("Hello, ", c.String("name")) - }, - }, { - Name: "spanish", - Aliases: []string{"sp"}, - Usage: "sends a greeting in spanish", - Flags: []Flag{ - StringFlag{ - Name: "surname", - Value: "Jones", - Usage: "Surname of the person to greet", - }, - }, - Action: func(c *Context) { - println("Hola, ", c.String("surname")) - }, - }, { - Name: "french", - Aliases: []string{"fr"}, - Usage: "sends a greeting in french", - Flags: []Flag{ - StringFlag{ - Name: "nickname", - Value: "Stevie", - Usage: "Nickname of the person to greet", - }, - }, - Action: func(c *Context) { - println("Bonjour, ", c.String("nickname")) - }, - }, - }, - }, { - Name: "bye", - Usage: "says goodbye", - Action: func(c *Context) { - println("bye") - }, - }, - } - - app.Run(os.Args) -}