File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
tests/ConsoleAppFramework.Tests Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ public CommandHelpDefinition CreateCommandHelpDefinition(MethodInfo method)
361361 }
362362
363363 return new CommandHelpDefinition (
364- $ " { method . DeclaringType ! . Name . ToLower ( ) } " ,
364+ method . DeclaringType . GetCustomAttribute < CommandAttribute > ( ) ? . CommandNames ? . FirstOrDefault ( ) ?? method . DeclaringType ! . Name . ToLower ( ) ,
365365 command ? . CommandNames ?? new [ ] { method . Name . ToLower ( ) } ,
366366 parameterDefinitions . OrderBy ( x => x . Index ?? int . MaxValue ) . ToArray ( ) ,
367367 command ? . Description ?? String . Empty
Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ public void BuildMethodListMessage()
1919 var builder = CreateCommandHelpBuilder ( ) ;
2020 var expected = @$ "
2121Commands:
22- commandhelptestlistmessagebatch hello
23- commandhelptestlistmessagebatch YetAnotherHello
24- commandhelptestlistmessagebatch HelloWithAliasWithDescription Description of command
22+ list-message-batch hello
23+ list-message-batch YetAnotherHello
24+ list-message-batch HelloWithAliasWithDescription Description of command
2525" . TrimStart ( ) ;
2626
2727 var msg = builder . BuildMethodListMessage ( new [ ] { typeof ( CommandHelpTestListMessageBatch ) } , out _ ) ;
@@ -36,9 +36,9 @@ public void BuildUsageMessage_Types()
3636 var expected = @"Usage: Nantoka <Command>
3737
3838Commands:
39- commandhelptestlistmessagebatch hello
40- commandhelptestlistmessagebatch YetAnotherHello
41- commandhelptestlistmessagebatch HelloWithAliasWithDescription Description of command
39+ list-message-batch hello
40+ list-message-batch YetAnotherHello
41+ list-message-batch HelloWithAliasWithDescription Description of command
4242" ;
4343
4444 builder . BuildHelpMessage ( new [ ] { typeof ( CommandHelpTestListMessageBatch ) } ) . Should ( ) . Be ( expected ) ;
@@ -342,6 +342,7 @@ public void CreateCommandHelp_BooleanWithTrueDefault_ShownWithoutValue()
342342 //}
343343 }
344344
345+ [ Command ( "list-message-batch" ) ]
345346 public class CommandHelpTestListMessageBatch : ConsoleAppBase
346347 {
347348 public void Hello ( )
You can’t perform that action at this time.
0 commit comments