Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codegangsta/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioMeireles committed Feb 5, 2014
2 parents 6dde773 + 8242fd8 commit 563b43c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,22 @@ func TestApp_BeforeFunc(t *testing.T) {
}

}

func TestAppHelpPrinter(t *testing.T) {
oldPrinter := cli.HelpPrinter
defer func() {
cli.HelpPrinter = oldPrinter
}()

var wasCalled = false
cli.HelpPrinter = func(template string, data interface{}) {
wasCalled = true
}

app := cli.NewApp()
app.Run([]string{"-h"})

if wasCalled == false {
t.Errorf("Help printer expected to be called, but was not")
}
}
3 changes: 2 additions & 1 deletion help.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ var helpCommand = Command{
}

// Prints help for the App
var HelpPrinter = printHelp
func ShowAppHelp(c *Context) {
printHelp(AppHelpTemplate, c.App)
HelpPrinter(AppHelpTemplate, c.App)
}

// Prints help for the given command
Expand Down

0 comments on commit 563b43c

Please sign in to comment.