diff --git a/README.md b/README.md index 5e73ffee..db36e1ee 100644 --- a/README.md +++ b/README.md @@ -524,13 +524,15 @@ around it. In fact, you can provide your own if you want. ### Defining your own help -You can provide your own Help command or your own template for the default command to use +You can provide your own Help command or your own template or help strings for the default command to use with following functions: ```go cmd.SetHelpCommand(cmd *Command) cmd.SetHelpFunc(f func(*Command, []string)) cmd.SetHelpTemplate(s string) +cmd.SetShortHelpString(s string) +cmd.SetLongHelpString(s string) ``` The latter two will also apply to any children commands. diff --git a/command.go b/command.go index 34d1bf36..599e5628 100644 --- a/command.go +++ b/command.go @@ -240,6 +240,16 @@ func (c *Command) SetHelpTemplate(s string) { c.helpTemplate = s } +// SetShortHelpString sets short help string to be used. Application can use it to set custom short help string. +func (c *Command) SetShortHelpString(s string) { + c.helpCommand.Short = s +} + +// SetLongHelpString sets long help string to be used. Application can use it to set custom long help string. +func (c *Command) SetLongHelpString(s string) { + c.helpCommand.Long = s +} + // SetVersionTemplate sets version template to be used. Application can use it to set custom template. func (c *Command) SetVersionTemplate(s string) { c.versionTemplate = s