File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -853,7 +853,7 @@ private IEnumerable<Specification> AdaptVerbsToSpecifications(IEnumerable<Type>
853
853
string . Empty ,
854
854
verbTuple . Item1 . Name ,
855
855
false ,
856
- verbTuple . Item1 . HelpText ,
856
+ verbTuple . Item1 . IsDefault ? "(Default Verb) " + verbTuple . Item1 . HelpText : verbTuple . Item1 . HelpText , //Default verb
857
857
string . Empty ,
858
858
verbTuple . Item1 . Hidden ) ;
859
859
if ( autoHelp )
Original file line number Diff line number Diff line change @@ -18,7 +18,20 @@ public class Add_Verb
18
18
[ Value ( 0 ) ]
19
19
public string FileName { get ; set ; }
20
20
}
21
+ [ Verb ( "add" , isDefault : true , HelpText = "Add file contents to the index." ) ]
22
+ public class Add_Verb_As_Default
23
+ {
24
+ [ Option ( 'p' , "patch" , SetName = "mode-p" ,
25
+ HelpText = "Interactively choose hunks of patch between the index and the work tree and add them to the index." ) ]
26
+ public bool Patch { get ; set ; }
21
27
28
+ [ Option ( 'f' , "force" , SetName = "mode-f" ,
29
+ HelpText = "Allow adding otherwise ignored files." ) ]
30
+ public bool Force { get ; set ; }
31
+
32
+ [ Value ( 0 ) ]
33
+ public string FileName { get ; set ; }
34
+ }
22
35
[ Verb ( "commit" , HelpText = "Record changes to the repository." ) ]
23
36
public class Commit_Verb
24
37
{
Original file line number Diff line number Diff line change @@ -370,7 +370,30 @@ public void Implicit_help_screen_in_verb_scenario()
370
370
lines [ 8 ] . Should ( ) . BeEquivalentTo ( "version Display version information." ) ;
371
371
// Teardown
372
372
}
373
+
374
+ [ Fact ]
375
+ public void Help_screen_in_default_verb_scenario ( )
376
+ {
377
+ // Fixture setup
378
+ var help = new StringWriter ( ) ;
379
+ var sut = new Parser ( config => config . HelpWriter = help ) ;
373
380
381
+ // Exercise system
382
+ sut . ParseArguments < Add_Verb_As_Default , Commit_Verb , Clone_Verb > ( new string [ ] { "--help" } ) ;
383
+ var result = help . ToString ( ) ;
384
+
385
+ // Verify outcome
386
+ result . Length . Should ( ) . BeGreaterThan ( 0 ) ;
387
+ var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
388
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
389
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
390
+ lines [ 2 ] . Should ( ) . BeEquivalentTo ( "add (Default Verb) Add file contents to the index." ) ;
391
+ lines [ 3 ] . Should ( ) . BeEquivalentTo ( "commit Record changes to the repository." ) ;
392
+ lines [ 4 ] . Should ( ) . BeEquivalentTo ( "clone Clone a repository into a new directory." ) ;
393
+ lines [ 5 ] . Should ( ) . BeEquivalentTo ( "help Display more information on a specific command." ) ;
394
+ lines [ 6 ] . Should ( ) . BeEquivalentTo ( "version Display version information." ) ;
395
+
396
+ }
374
397
[ Fact ]
375
398
public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario ( )
376
399
{
You can’t perform that action at this time.
0 commit comments