fix trailing <nil> on help output
This commit is contained in:
parent
c491be3a31
commit
39583856c0
@ -176,6 +176,15 @@ func (c *Command) Usage() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Command) UsageString() string {
|
||||||
|
tmpOutput := c.Commander().cmdr.output
|
||||||
|
bb := new(bytes.Buffer)
|
||||||
|
c.Commander().SetOutput(bb)
|
||||||
|
c.Usage()
|
||||||
|
c.Commander().cmdr.output = tmpOutput
|
||||||
|
return bb.String()
|
||||||
|
}
|
||||||
|
|
||||||
// The full path to this command
|
// The full path to this command
|
||||||
func (c *Command) CommandPath() string {
|
func (c *Command) CommandPath() string {
|
||||||
str := c.Name()
|
str := c.Name()
|
||||||
|
@ -143,8 +143,7 @@ Additional help topics: {{if gt .Commands 0 }}{{range .Commands}}{{if not .Runna
|
|||||||
Use "{{.Commander.Name}} help [command]" for more information about that command.
|
Use "{{.Commander.Name}} help [command]" for more information about that command.
|
||||||
`
|
`
|
||||||
|
|
||||||
c.HelpTemplate = `{{.Name}}
|
c.HelpTemplate = `{{.Long | trim}}
|
||||||
{{.Long | trim}}
|
{{if .Runnable}}{{.UsageString}}{{end}}
|
||||||
{{if .Runnable}}{{.Usage}}{{end}}
|
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user