Skip to content

Commit 843fb62

Browse files
Add short forms of some options in dotnet test (#46827)
1 parent 052b003 commit 843fb62

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/Cli/dotnet/commands/dotnet-test/CliConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal static class CliConstants
77
{
88
public const string DotnetRunCommand = "dotnet run";
99
public const string HelpOptionKey = "--help";
10+
public const string ShortHelpOptionKey = "-h";
1011
public const string ServerOptionKey = "--server";
1112
public const string DotNetTestPipeOptionKey = "--dotnet-test-pipe";
1213
public const string FrameworkOptionKey = "--framework";

src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static BuildOptions GetBuildOptions(ParseResult parseResult, int degreeO
204204
msbuildArgs);
205205
}
206206

207-
private static bool ContainsHelpOption(IEnumerable<string> args) => args.Contains(CliConstants.HelpOptionKey) || args.Contains(CliConstants.HelpOptionKey.Substring(0, 2));
207+
private static bool ContainsHelpOption(IEnumerable<string> args) => args.Contains(CliConstants.HelpOptionKey) || args.Contains(CliConstants.ShortHelpOptionKey);
208208

209209
private void CompleteRun()
210210
{

src/Cli/dotnet/commands/dotnet-test/TestingPlatformOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal static class TestingPlatformOptions
4646
Arity = ArgumentArity.ExactlyOne
4747
};
4848

49-
public static readonly CliOption<string> ListTestsOption = new("--list-tests")
49+
public static readonly CliOption<string> ListTestsOption = new("--list-tests", "-t")
5050
{
5151
Description = LocalizableStrings.CmdListTestsDescription,
5252
Arity = ArgumentArity.Zero

test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsHelp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void RunHelpOnMultipleTestProjects_ShouldReturnZeroAsExitCode(string conf
4545
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: false)
4646
.WithWorkingDirectory(testInstance.Path)
4747
.WithEnableTestingPlatform()
48-
.Execute(CliConstants.HelpOptionKey, TestingPlatformOptions.ConfigurationOption.Name, configuration);
48+
.Execute(CliConstants.ShortHelpOptionKey, TestingPlatformOptions.ConfigurationOption.Name, configuration);
4949

5050
if (!TestContext.IsLocalized())
5151
{

0 commit comments

Comments
 (0)