File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ func ShowAppHelp(c *Context) error {
148
148
149
149
// ShowCommandHelp prints help for the given command
150
150
func ShowCommandHelp (ctx * Context , command string ) error {
151
- if c := ctx .App .Command (command ); c != nil {
151
+ if c := ctx .App .BestCommand (command ); c != nil {
152
152
if c .DescriptionFunc != nil {
153
153
c .Description = c .DescriptionFunc (c , ctx .App )
154
154
}
Original file line number Diff line number Diff line change @@ -237,6 +237,29 @@ func TestShowCommandHelp_CommandAliases(t *testing.T) {
237
237
}
238
238
}
239
239
240
+ func TestShowCommandHelp_CommandShortcut (t * testing.T ) {
241
+ app := & Application {
242
+ Commands : []* Command {
243
+ {
244
+ Name : "bar" ,
245
+ Category : "foo" ,
246
+ Aliases : []* Alias {{Name : "fb" }},
247
+ Action : func (ctx * Context ) error {
248
+ return nil
249
+ },
250
+ },
251
+ },
252
+ }
253
+
254
+ output := & bytes.Buffer {}
255
+ app .Writer = output
256
+ app .Run ([]string {"foo" , "help" , "f:b" })
257
+
258
+ if ! strings .Contains (output .String (), "foo:bar" ) {
259
+ t .Errorf ("expected output to include command name; got: %q" , output .String ())
260
+ }
261
+ }
262
+
240
263
func TestShowCommandHelp_DescriptionFunc (t * testing.T ) {
241
264
app := & Application {
242
265
Commands : []* Command {
You can’t perform that action at this time.
0 commit comments