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)
|
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())
|
if (parseResult.Errors.Any())
|
||||||
{
|
{
|
||||||
throw new CommandParsingException(
|
throw new CommandParsingException(
|
||||||
string.Join(Environment.NewLine,
|
string.Join(Environment.NewLine,
|
||||||
parseResult.Errors.Select(e => e.Message)));
|
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()
|
Accept.ExactlyOneArgument()
|
||||||
.ExistingSlnFileOrDirectoryOnly()
|
.ExistingSlnFileOrDirectoryOnly()
|
||||||
.DefaultToCurrentDirectory()
|
.DefaultToCurrentDirectory()
|
||||||
.With(name: "SLN_FILE" ),
|
.With(name: "SLN_FILE"),
|
||||||
CommonOptions.HelpOption(),
|
CommonOptions.HelpOption(),
|
||||||
Create.Command("add",
|
Create.Command("add",
|
||||||
".NET Add project(s) to a solution file Command",
|
".NET Add project(s) to a solution file Command",
|
||||||
|
@ -25,6 +25,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
CommonOptions.HelpOption()),
|
CommonOptions.HelpOption()),
|
||||||
Create.Command("remove",
|
Create.Command("remove",
|
||||||
"Remove the specified project(s) from the solution. The project is not impacted.",
|
"Remove the specified project(s) from the solution. The project is not impacted.",
|
||||||
Accept.OneOrMoreArguments()));
|
Accept.OneOrMoreArguments(),
|
||||||
|
CommonOptions.HelpOption()));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue