Add <command> to help when a sub-command is required.

This commit is contained in:
Alec Thomas
2018-06-08 15:04:26 +10:00
parent d30421d2b1
commit 73064a687f
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ var CLI struct {
Debug bool `help:"Debug mode."` Debug bool `help:"Debug mode."`
Rm struct { Rm struct {
User string `help:"Run as user." short:"u"` User string `help:"Run as user." short:"u" default:"default"`
Force bool `help:"Force removal." short:"f"` Force bool `help:"Force removal." short:"f"`
Recursive bool `help:"Recursively remove files." short:"r"` Recursive bool `help:"Recursively remove files." short:"r"`
+1 -1
View File
@@ -50,7 +50,7 @@ func TestHelp(t *testing.T) {
}) })
require.True(t, exited) require.True(t, exited)
t.Log(w.String()) t.Log(w.String())
require.Equal(t, `usage: test-app --required require.Equal(t, `usage: test-app --required <command>
A test app. A test app.
+2
View File
@@ -89,6 +89,8 @@ func (n *Node) Summary() string {
} }
if len(args) != 0 { if len(args) != 0 {
summary += " " + strings.Join(args, " ") summary += " " + strings.Join(args, " ")
} else if len(n.Children) > 0 {
summary += " <command>"
} }
return summary return summary
} }