parent
c606efc92b
commit
58bfabca6d
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
3
help.go
3
help.go
@ -59,8 +59,9 @@ var helpCommand = Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prints help for the App
|
// Prints help for the App
|
||||||
|
var HelpPrinter = printHelp
|
||||||
func ShowAppHelp(c *Context) {
|
func ShowAppHelp(c *Context) {
|
||||||
printHelp(AppHelpTemplate, c.App)
|
HelpPrinter(AppHelpTemplate, c.App)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints help for the given command
|
// Prints help for the given command
|
||||||
|
Loading…
Reference in New Issue
Block a user