@@ -307,17 +307,14 @@ public override void Write(HelpContext context)
307307 {
308308 var command = context . Command ;
309309 var helpArgs = new string [ ] { "--help" } ;
310+
311+ // custom help overrides
310312 if ( command . Equals ( RootCommand ) )
311313 {
312314 Console . Out . WriteLine ( CliUsage . HelpText ) ;
313315 return ;
314316 }
315317
316- foreach ( var option in command . Options )
317- {
318- option . EnsureHelpName ( ) ;
319- }
320-
321318 if ( command . Equals ( NuGetCommandParser . GetCommand ( ) ) || command . Parents . Any ( parent => parent == NuGetCommandParser . GetCommand ( ) ) )
322319 {
323320 NuGetCommand . Run ( context . ParseResult ) ;
@@ -357,34 +354,38 @@ public override void Write(HelpContext context)
357354 {
358355 new FsiForwardingApp ( helpArgs ) . Execute ( ) ;
359356 }
360- else
357+
358+ // argument/option cleanups specific to help
359+ foreach ( var option in command . Options )
361360 {
362- if ( command . Name . Equals ( ListReferenceCommandParser . GetCommand ( ) . Name ) )
363- {
364- Command listCommand = command . Parents . Single ( ) as Command ;
361+ option . EnsureHelpName ( ) ;
362+ }
365363
366- for ( int i = 0 ; i < listCommand . Arguments . Count ; i ++ )
364+ if ( command . Name . Equals ( ListReferenceCommandParser . GetCommand ( ) . Name ) )
365+ {
366+ Command listCommand = command . Parents . Single ( ) as Command ;
367+
368+ for ( int i = 0 ; i < listCommand . Arguments . Count ; i ++ )
369+ {
370+ if ( listCommand . Arguments [ i ] . Name == CliStrings . SolutionOrProjectArgumentName )
367371 {
368- if ( listCommand . Arguments [ i ] . Name == CliStrings . SolutionOrProjectArgumentName )
369- {
370- // Name is immutable now, so we create a new Argument with the right name..
371- listCommand . Arguments [ i ] = ListCommandParser . CreateSlnOrProjectArgument ( CliStrings . ProjectArgumentName , CliStrings . ProjectArgumentDescription ) ;
372- }
372+ // Name is immutable now, so we create a new Argument with the right name..
373+ listCommand . Arguments [ i ] = ListCommandParser . CreateSlnOrProjectArgument ( CliStrings . ProjectArgumentName , CliStrings . ProjectArgumentDescription ) ;
373374 }
374375 }
375- else if ( command . Name . Equals ( AddPackageCommandParser . GetCommand ( ) . Name ) || command . Name . Equals ( AddCommandParser . GetCommand ( ) . Name ) )
376- {
377- // Don't show package completions in help
378- PackageAddCommandParser . CmdPackageArgument . CompletionSources . Clear ( ) ;
379- }
380- else if ( command . Name . Equals ( WorkloadSearchCommandParser . GetCommand ( ) . Name ) )
381- {
382- // Set shorter description for displaying parent command help.
383- WorkloadSearchVersionsCommandParser . GetCommand ( ) . Description = CliStrings . ShortWorkloadSearchVersionDescription ;
384- }
385-
386- base . Write ( context ) ;
387376 }
377+ else if ( command . Name . Equals ( AddPackageCommandParser . GetCommand ( ) . Name ) || command . Name . Equals ( AddCommandParser . GetCommand ( ) . Name ) )
378+ {
379+ // Don't show package completions in help
380+ PackageAddCommandParser . CmdPackageArgument . CompletionSources . Clear ( ) ;
381+ }
382+ else if ( command . Name . Equals ( WorkloadSearchCommandParser . GetCommand ( ) . Name ) )
383+ {
384+ // Set shorter description for displaying parent command help.
385+ WorkloadSearchVersionsCommandParser . GetCommand ( ) . Description = CliStrings . ShortWorkloadSearchVersionDescription ;
386+ }
387+
388+ base . Write ( context ) ;
388389 }
389390 }
390391}
0 commit comments