File tree Expand file tree Collapse file tree 1 file changed +3
-26
lines changed Expand file tree Collapse file tree 1 file changed +3
-26
lines changed Original file line number Diff line number Diff line change 1- using System ;
2- using System . Collections . Generic ;
1+ using System . Collections . Generic ;
32using System . Linq ;
43using CommandLine ;
54using CommandLine . Text ;
@@ -13,35 +12,13 @@ public virtual void Schedule(ISchedule schedule)
1312 { }
1413
1514 [ HelpVerbOption ]
16- public string GetUsage ( string verb )
15+ public virtual string GetUsage ( string verb )
1716 {
1817 var helpText = HelpText . AutoBuild ( this , verb ) ;
19- helpText . Heading = $ "{ GetType ( ) . Assembly . GetName ( ) . Name } v { GetType ( ) . Assembly . GetName ( ) . Version . ToString ( ) } ";
18+ helpText . Heading = $ "{ GetType ( ) . Assembly . GetName ( ) . Name } { GetType ( ) . Assembly . GetName ( ) . Version . ToString ( ) } ";
2019 return helpText ;
2120 }
2221
23- public virtual string GetUsageWithoutHeader ( )
24- {
25- var verbs = GetType ( )
26- . GetProperties ( )
27- . ToList ( )
28- . SelectMany ( x => {
29- return x . GetCustomAttributes ( typeof ( VerbOptionAttribute ) , true ) . Select ( y => y as VerbOptionAttribute ) ;
30- } ) ;
31- var maxWidth = 0 ;
32- foreach ( var verb in verbs )
33- if ( verb . LongName != null && verb . LongName . Length > maxWidth )
34- maxWidth = verb . LongName . Length ;
35-
36- var helpTextLine = verbs . Select ( x => {
37- var name = ( x . LongName ?? "" ) ;
38- var padding = maxWidth - name . Length + 2 ;
39- return $ " { name } " + string . Join ( "" , Enumerable . Range ( 0 , padding ) . Select ( y => " " ) ) + ( x . HelpText ?? "" ) ;
40- } ) ;
41-
42- return string . Join ( Environment . NewLine , helpTextLine ) ;
43- }
44-
4522 public IList < VerbOptionAttribute > GetVerbOptions ( )
4623 {
4724 return GetType ( )
You can’t perform that action at this time.
0 commit comments