@@ -307,17 +307,14 @@ public override void Write(HelpContext context)
307
307
{
308
308
var command = context . Command ;
309
309
var helpArgs = new string [ ] { "--help" } ;
310
+
311
+ // custom help overrides
310
312
if ( command . Equals ( RootCommand ) )
311
313
{
312
314
Console . Out . WriteLine ( CliUsage . HelpText ) ;
313
315
return ;
314
316
}
315
317
316
- foreach ( var option in command . Options )
317
- {
318
- option . EnsureHelpName ( ) ;
319
- }
320
-
321
318
if ( command . Equals ( NuGetCommandParser . GetCommand ( ) ) || command . Parents . Any ( parent => parent == NuGetCommandParser . GetCommand ( ) ) )
322
319
{
323
320
NuGetCommand . Run ( context . ParseResult ) ;
@@ -357,34 +354,38 @@ public override void Write(HelpContext context)
357
354
{
358
355
new FsiForwardingApp ( helpArgs ) . Execute ( ) ;
359
356
}
360
- else
357
+
358
+ // argument/option cleanups specific to help
359
+ foreach ( var option in command . Options )
361
360
{
362
- if ( command . Name . Equals ( ListReferenceCommandParser . GetCommand ( ) . Name ) )
363
- {
364
- Command listCommand = command . Parents . Single ( ) as Command ;
361
+ option . EnsureHelpName ( ) ;
362
+ }
365
363
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 )
367
371
{
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 ) ;
373
374
}
374
375
}
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 ) ;
387
376
}
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 ) ;
388
389
}
389
390
}
390
391
}
0 commit comments