Skip to content

Commit

Permalink
help: include usage if defined, even if not executable
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Aug 19, 2023
1 parent e875b5c commit 5b307d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (c *C) HelpInfo(includeCommands bool) HelpInfo {
Synopsis: strings.SplitN(help, "\n", 2)[0],
Help: help,
}
if c.Runnable() {
h.Usage = "Usage:\n\n" + indent(prefix, prefix, strings.Join(c.usageLines(), "\n"))
if u := c.usageLines(); len(u) != 0 {
h.Usage = "Usage:\n\n" + indent(prefix, prefix, strings.Join(u, "\n"))
}
if c.hasFlagsDefined() {
var buf bytes.Buffer
Expand Down

0 comments on commit 5b307d7

Please sign in to comment.