reverse order of help response vs error response
This commit is contained in:
parent
204d8594bf
commit
f5d9cfc79c
2 changed files with 9 additions and 8 deletions
|
@ -14,18 +14,18 @@ namespace Microsoft.DotNet.Cli
|
|||
|
||||
public static void ShowHelpOrErrorIfAppropriate(this ParseResult parseResult)
|
||||
{
|
||||
if (parseResult.AppliedCommand().HasOption("help"))
|
||||
{
|
||||
// NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point.
|
||||
throw new HelpException(parseResult.Command().HelpView());
|
||||
}
|
||||
|
||||
if (parseResult.Errors.Any())
|
||||
{
|
||||
throw new CommandParsingException(
|
||||
string.Join(Environment.NewLine,
|
||||
parseResult.Errors.Select(e => e.Message)));
|
||||
}
|
||||
|
||||
if (parseResult.AppliedCommand().HasOption("help"))
|
||||
{
|
||||
// NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point.
|
||||
throw new HelpException(parseResult.Command().HelpView());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Cli
|
|||
Accept.ExactlyOneArgument()
|
||||
.ExistingSlnFileOrDirectoryOnly()
|
||||
.DefaultToCurrentDirectory()
|
||||
.With(name: "SLN_FILE" ),
|
||||
.With(name: "SLN_FILE"),
|
||||
CommonOptions.HelpOption(),
|
||||
Create.Command("add",
|
||||
".NET Add project(s) to a solution file Command",
|
||||
|
@ -25,6 +25,7 @@ namespace Microsoft.DotNet.Cli
|
|||
CommonOptions.HelpOption()),
|
||||
Create.Command("remove",
|
||||
"Remove the specified project(s) from the solution. The project is not impacted.",
|
||||
Accept.OneOrMoreArguments()));
|
||||
Accept.OneOrMoreArguments(),
|
||||
CommonOptions.HelpOption()));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue