55using System . Collections . Generic ;
66using System . CommandLine . Builder ;
77using System . CommandLine . Help ;
8+ using System . CommandLine . Invocation ;
89using System . CommandLine . IO ;
910using System . CommandLine . Parsing ;
1011using System . IO ;
@@ -668,7 +669,7 @@ public void Arguments_section_properly_wraps()
668669 var name = "argument-name-for-a-command-that-is-long-enough-to-wrap-to-a-new-line" ;
669670 var description = "Argument description for a command with line breaks that is long enough to wrap to a new line." ;
670671
671- var command = new RootCommand ( )
672+ var command = new RootCommand
672673 {
673674 new Argument
674675 {
@@ -690,33 +691,6 @@ public void Arguments_section_properly_wraps()
690691 _console . Out . ToString ( ) . Should ( ) . Contain ( expected ) ;
691692 }
692693
693- [ Theory ]
694- [ InlineData ( typeof ( bool ) ) ]
695- [ InlineData ( typeof ( bool ? ) ) ]
696- public void Command_argument_descriptor_is_empty_for_boolean_values ( Type type )
697- {
698- var description = "This is the argument description" ;
699-
700- var command = new Command ( "outer" , "Help text for the outer command" )
701- {
702- new Argument
703- {
704- Description = description ,
705- ArgumentType = type
706- }
707- } ;
708-
709- HelpBuilder helpBuilder = GetHelpBuilder ( SmallMaxWidth ) ;
710-
711- helpBuilder . Write ( command ) ;
712-
713- var expected =
714- $ "Arguments:{ NewLine } " +
715- $ "{ _indentation } { _columnPadding } { description } ";
716-
717- _console . Out . ToString ( ) . Should ( ) . Contain ( expected ) ;
718- }
719-
720694 [ Theory ]
721695 [ InlineData ( typeof ( FileAccess ) ) ]
722696 [ InlineData ( typeof ( FileAccess ? ) ) ]
@@ -764,6 +738,27 @@ public void Option_argument_descriptor_is_empty_for_boolean_values(Type type)
764738 _console . Out . ToString ( ) . Should ( ) . Contain ( $ "--opt{ _columnPadding } { description } ") ;
765739 }
766740
741+ [ Fact ] // https://github.com/dotnet/command-line-api/issues/1157
742+ public void Command_arguments_show_argument_name_as_descriptor ( )
743+ {
744+ var command = new RootCommand
745+ {
746+ new Argument < bool > ( "boolArgument" , "Some value" ) ,
747+ new Argument < int > ( "intArgument" , "Another value" ) ,
748+ } ;
749+
750+ var helpBuilder = GetHelpBuilder ( SmallMaxWidth ) ;
751+
752+ helpBuilder . Write ( command ) ;
753+
754+ var expected =
755+ $ "Arguments:{ NewLine } " +
756+ $ "{ _indentation } <boolArgument>{ _columnPadding } Some value{ NewLine } " +
757+ $ "{ _indentation } <intArgument> { _columnPadding } Another value{ NewLine } ";
758+
759+ _console . Out . ToString ( ) . Should ( ) . Contain ( expected ) ;
760+ }
761+
767762 [ Theory ]
768763 [ InlineData ( typeof ( FileAccess ) ) ]
769764 [ InlineData ( typeof ( FileAccess ? ) ) ]
@@ -878,7 +873,7 @@ public void Command_arguments_can_customize_default_value()
878873 }
879874
880875 [ Fact ]
881- public void Command_arguments_can_customize_dedescriptor ( )
876+ public void Command_arguments_can_customize_descriptor ( )
882877 {
883878 var argument = new Argument < string > ( "some-arg" , getDefaultValue : ( ) => "not 42" ) ;
884879 var command = new Command ( "the-command" , "command help" )
0 commit comments