@@ -430,11 +430,14 @@ public static string RenderUsageText<T>(ParserResult<T> parserResult)
430430 {
431431 if ( parserResult == null ) throw new ArgumentNullException ( "parserResult" ) ;
432432
433- var examples = GetUsageFromType ( parserResult . TypeInfo . Current )
434- . Return ( x => x , Enumerable . Empty < Example > ( ) ) ;
435- if ( examples . Empty ( ) )
433+ var usage = GetUsageFromType ( parserResult . TypeInfo . Current ) ;
434+ if ( usage . MatchNothing ( ) )
436435 return string . Empty ;
437436
437+ var usageTuple = usage . FromJust ( ) ;
438+ var examples = usageTuple . Item2 ;
439+ var appAlias = usageTuple . Item1 . ApplicationAlias ?? ReflectionHelper . GetAssemblyName ( ) ;
440+
438441 var text = new StringBuilder ( ) ;
439442 foreach ( var e in examples )
440443 {
@@ -447,6 +450,8 @@ public static string RenderUsageText<T>(ParserResult<T> parserResult)
447450 {
448451 var commandLine = new StringBuilder ( )
449452 . Append ( 2 . Spaces ( ) )
453+ . Append ( appAlias )
454+ . Append ( ' ' )
450455 . Append ( Parser . Default . FormatCommandLine ( e . Sample ,
451456 config =>
452457 {
@@ -540,7 +545,7 @@ private IEnumerable<Specification> GetSpecificationsFromType(Type type)
540545 . Concat ( valueSpecs ) ;
541546 }
542547
543- private static Maybe < IEnumerable < Example > > GetUsageFromType ( Type type )
548+ private static Maybe < Tuple < UsageAttribute , IEnumerable < Example > > > GetUsageFromType ( Type type )
544549 {
545550 return type . GetUsageData ( ) . Map (
546551 tuple =>
@@ -550,14 +555,15 @@ private static Maybe<IEnumerable<Example>> GetUsageFromType(Type type)
550555
551556 var examples = ( IEnumerable < Example > ) prop
552557 . GetValue ( null , BindingFlags . Public | BindingFlags . Static | BindingFlags . GetProperty , null , null , null ) ;
553- var groups = attr . Groups ;
554-
555- return examples . Select ( example => groups . ContainsKey ( example . Group )
556- ? example . WithGroupDescription ( groups [ example . Group ] )
557- : example )
558- . OrderBy ( x => x . Group )
559- . ThenBy ( x => x . GroupDescription )
560- . Memorize ( ) ;
558+ //var groups = attr.Groups;
559+
560+ //return examples.Select(example => groups.ContainsKey(example.Group)
561+ // ? example.WithGroupDescription(groups[example.Group])
562+ // : example)
563+ // .OrderBy(x => x.Group)
564+ // .ThenBy(x => x.GroupDescription)
565+ // .Memorize();
566+ return Tuple . Create ( attr , examples ) ;
561567 } ) ;
562568 }
563569
0 commit comments