parent
be9134f512
commit
f972cf80a9
4 changed files with 13 additions and 2 deletions
|
@ -148,7 +148,12 @@ namespace Microsoft.DotNet.Cli.CommandLine
|
||||||
var arg = args[index];
|
var arg = args[index];
|
||||||
|
|
||||||
bool isLongOption = arg.StartsWith("--");
|
bool isLongOption = arg.StartsWith("--");
|
||||||
if (isLongOption || arg.StartsWith("-"))
|
if (arg == "-?" || arg == "/?")
|
||||||
|
{
|
||||||
|
command.ShowHelp();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (isLongOption || arg.StartsWith("-"))
|
||||||
{
|
{
|
||||||
CommandOption option;
|
CommandOption option;
|
||||||
var result = ParseOption(isLongOption, command, args, ref index, out option);
|
var result = ParseOption(isLongOption, command, args, ref index, out option);
|
||||||
|
|
|
@ -118,7 +118,9 @@ namespace Microsoft.DotNet.Cli
|
||||||
PrintInfo();
|
PrintInfo();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (IsArg(args[lastArg], "h", "help"))
|
else if (IsArg(args[lastArg], "h", "help") ||
|
||||||
|
args[lastArg] == "-?" ||
|
||||||
|
args[lastArg] == "/?")
|
||||||
{
|
{
|
||||||
HelpCommand.PrintHelp();
|
HelpCommand.PrintHelp();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -56,6 +56,8 @@ Advanced Commands:
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("--help")]
|
[InlineData("--help")]
|
||||||
[InlineData("-h")]
|
[InlineData("-h")]
|
||||||
|
[InlineData("-?")]
|
||||||
|
[InlineData("/?")]
|
||||||
public void WhenHelpOptionIsPassedToDotnetItPrintsUsage(string helpArg)
|
public void WhenHelpOptionIsPassedToDotnetItPrintsUsage(string helpArg)
|
||||||
{
|
{
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
|
|
|
@ -182,6 +182,8 @@ EndGlobal
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("--help")]
|
[InlineData("--help")]
|
||||||
[InlineData("-h")]
|
[InlineData("-h")]
|
||||||
|
[InlineData("-?")]
|
||||||
|
[InlineData("/?")]
|
||||||
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
|
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
|
||||||
{
|
{
|
||||||
var cmd = new DotnetCommand()
|
var cmd = new DotnetCommand()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue