Add aliases to ALL help output (#191)
This commit is contained in:
+5
-5
@@ -342,7 +342,7 @@ Run "test-app <command> --help" for more information on a command.
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
require.True(t, exited)
|
require.True(t, exited)
|
||||||
expected := `Usage: test-app one <command>
|
expected := `Usage: test-app one (un,uno) <command>
|
||||||
|
|
||||||
subcommand one
|
subcommand one
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ Commands:
|
|||||||
two Another subcommand.
|
two Another subcommand.
|
||||||
|
|
||||||
Group A
|
Group A
|
||||||
one subcommand one
|
one (un,uno) subcommand one
|
||||||
|
|
||||||
Run "test-app <command> --help" for more information on a command.
|
Run "test-app <command> --help" for more information on a command.
|
||||||
`
|
`
|
||||||
@@ -432,7 +432,7 @@ Run "test-app <command> --help" for more information on a command.
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
require.True(t, exited)
|
require.True(t, exited)
|
||||||
expected := `Usage: test-app one <command>
|
expected := `Usage: test-app one (un,uno) <command>
|
||||||
|
|
||||||
subcommand one
|
subcommand one
|
||||||
|
|
||||||
@@ -440,8 +440,8 @@ Flags:
|
|||||||
-h, --help Show context-sensitive help.
|
-h, --help Show context-sensitive help.
|
||||||
|
|
||||||
Group A
|
Group A
|
||||||
one thing subcommand thing
|
one (un,uno) thing subcommand thing
|
||||||
one <other> subcommand other
|
one (un,uno) <other> subcommand other
|
||||||
`
|
`
|
||||||
if expected != w.String() {
|
if expected != w.String() {
|
||||||
t.Errorf("help command returned:\n%v\n\nwant:\n%v", w.String(), expected)
|
t.Errorf("help command returned:\n%v\n\nwant:\n%v", w.String(), expected)
|
||||||
|
|||||||
@@ -204,6 +204,9 @@ func (n *Node) Path() (out string) {
|
|||||||
switch n.Type {
|
switch n.Type {
|
||||||
case CommandNode:
|
case CommandNode:
|
||||||
out += " " + n.Name
|
out += " " + n.Name
|
||||||
|
if len(n.Aliases) > 0 {
|
||||||
|
out += fmt.Sprintf(" (%s)", strings.Join(n.Aliases, ","))
|
||||||
|
}
|
||||||
case ArgumentNode:
|
case ArgumentNode:
|
||||||
out += " " + "<" + n.Name + ">"
|
out += " " + "<" + n.Name + ">"
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user