Skip to content

Commit 9acd4b3

Browse files
committed
Fix duplicate help output
1 parent 9240863 commit 9acd4b3

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

src/Cli/dotnet/Parser.cs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -354,38 +354,40 @@ public override void Write(HelpContext context)
354354
{
355355
new FsiForwardingApp(helpArgs).Execute();
356356
}
357-
358-
// argument/option cleanups specific to help
359-
foreach (var option in command.Options)
360-
{
361-
option.EnsureHelpName();
362-
}
363-
364-
if (command.Name.Equals(ListReferenceCommandParser.GetCommand().Name))
357+
else
365358
{
366-
Command listCommand = command.Parents.Single() as Command;
359+
// argument/option cleanups specific to help
360+
foreach (var option in command.Options)
361+
{
362+
option.EnsureHelpName();
363+
}
367364

368-
for (int i = 0; i < listCommand.Arguments.Count; i++)
365+
if (command.Name.Equals(ListReferenceCommandParser.GetCommand().Name))
369366
{
370-
if (listCommand.Arguments[i].Name == CliStrings.SolutionOrProjectArgumentName)
367+
Command listCommand = command.Parents.Single() as Command;
368+
369+
for (int i = 0; i < listCommand.Arguments.Count; i++)
371370
{
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);
371+
if (listCommand.Arguments[i].Name == CliStrings.SolutionOrProjectArgumentName)
372+
{
373+
// Name is immutable now, so we create a new Argument with the right name..
374+
listCommand.Arguments[i] = ListCommandParser.CreateSlnOrProjectArgument(CliStrings.ProjectArgumentName, CliStrings.ProjectArgumentDescription);
375+
}
374376
}
375377
}
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-
}
378+
else if (command.Name.Equals(AddPackageCommandParser.GetCommand().Name) || command.Name.Equals(AddCommandParser.GetCommand().Name))
379+
{
380+
// Don't show package completions in help
381+
PackageAddCommandParser.CmdPackageArgument.CompletionSources.Clear();
382+
}
383+
else if (command.Name.Equals(WorkloadSearchCommandParser.GetCommand().Name))
384+
{
385+
// Set shorter description for displaying parent command help.
386+
WorkloadSearchVersionsCommandParser.GetCommand().Description = CliStrings.ShortWorkloadSearchVersionDescription;
387+
}
387388

388-
base.Write(context);
389+
base.Write(context);
390+
}
389391
}
390392
}
391393
}

0 commit comments

Comments
 (0)