Merge pull request #65 from tjarratt/custom-help-printer
Add a way to override the app help printer
This commit is contained in:
commit
8242fd818c
19
app_test.go
19
app_test.go
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user