5
5
using System . Collections . Generic ;
6
6
using System . CommandLine . Builder ;
7
7
using System . CommandLine . Help ;
8
+ using System . CommandLine . Invocation ;
8
9
using System . CommandLine . IO ;
9
10
using System . CommandLine . Parsing ;
10
11
using System . IO ;
@@ -668,7 +669,7 @@ public void Arguments_section_properly_wraps()
668
669
var name = "argument-name-for-a-command-that-is-long-enough-to-wrap-to-a-new-line" ;
669
670
var description = "Argument description for a command with line breaks that is long enough to wrap to a new line." ;
670
671
671
- var command = new RootCommand ( )
672
+ var command = new RootCommand
672
673
{
673
674
new Argument
674
675
{
@@ -690,33 +691,6 @@ public void Arguments_section_properly_wraps()
690
691
_console . Out . ToString ( ) . Should ( ) . Contain ( expected ) ;
691
692
}
692
693
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
-
720
694
[ Theory ]
721
695
[ InlineData ( typeof ( FileAccess ) ) ]
722
696
[ InlineData ( typeof ( FileAccess ? ) ) ]
@@ -764,6 +738,27 @@ public void Option_argument_descriptor_is_empty_for_boolean_values(Type type)
764
738
_console . Out . ToString ( ) . Should ( ) . Contain ( $ "--opt{ _columnPadding } { description } ") ;
765
739
}
766
740
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
+
767
762
[ Theory ]
768
763
[ InlineData ( typeof ( FileAccess ) ) ]
769
764
[ InlineData ( typeof ( FileAccess ? ) ) ]
@@ -878,7 +873,7 @@ public void Command_arguments_can_customize_default_value()
878
873
}
879
874
880
875
[ Fact ]
881
- public void Command_arguments_can_customize_dedescriptor ( )
876
+ public void Command_arguments_can_customize_descriptor ( )
882
877
{
883
878
var argument = new Argument < string > ( "some-arg" , getDefaultValue : ( ) => "not 42" ) ;
884
879
var command = new Command ( "the-command" , "command help" )
0 commit comments