mirror of https://github.com/spf13/cobra.git
Print Long description when printing Help, fixes #20
This commit is contained in:
parent
8d72c1e167
commit
cdafa9f413
|
@ -139,7 +139,7 @@ func (c *Command) HelpFunc() func(*Command, []string) {
|
||||||
return func(c *Command, args []string) {
|
return func(c *Command, args []string) {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
// Help called without any topic, calling on root
|
// Help called without any topic, calling on root
|
||||||
c.Root().Usage()
|
c.Root().Help()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ func (c *Command) HelpTemplate() string {
|
||||||
return c.parent.HelpTemplate()
|
return c.parent.HelpTemplate()
|
||||||
} else {
|
} else {
|
||||||
return `{{.Long | trim}}
|
return `{{.Long | trim}}
|
||||||
{{if .Runnable}}{{.UsageString}}{{end}}
|
{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ func (c *Command) Execute() (err error) {
|
||||||
if c.Runnable() {
|
if c.Runnable() {
|
||||||
err = c.execute([]string(nil))
|
err = c.execute([]string(nil))
|
||||||
} else {
|
} else {
|
||||||
c.Usage()
|
c.Help()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = c.findAndExecute(args)
|
err = c.findAndExecute(args)
|
||||||
|
|
Loading…
Reference in New Issue