From 92fd7429a6be4ef7d441646084d50339c9e582f0 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 10:57:56 +0200 Subject: [PATCH 1/7] add ? and h for help option --- .../CommandLine/CommandLineHandler.cs | 2 +- .../CommandLine/CommandLineOption.cs | 2 +- .../CommandLine/PlatformCommandLineProvider.cs | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs index 03e64b0b45b..6734f2d9660 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs @@ -227,7 +227,7 @@ public bool TryGetOptionArgumentList(string optionName, [NotNullWhen(true)] out public Task IsEnabledAsync() => Task.FromResult(false); - public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey); + public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortcut1) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortcut2); public bool IsInfoInvoked() => IsOptionSet(PlatformCommandLineProvider.InfoOptionKey); diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOption.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOption.cs index 34e14da8f8c..265ce2cec77 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOption.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineOption.cs @@ -31,7 +31,7 @@ internal CommandLineOption(string name, string description, ArgumentArity arity, for (int i = 0; i < name.Length; i++) { - ArgumentGuard.Ensure(char.IsLetter(name[i]) || name[i] == '-', nameof(name), string.Format(CultureInfo.InvariantCulture, PlatformResources.CommandLineInvalidOptionName, name)); + ArgumentGuard.Ensure(char.IsLetter(name[i]) || name[i] == '-' || name[i] == '?', nameof(name), string.Format(CultureInfo.InvariantCulture, PlatformResources.CommandLineInvalidOptionName, name)); } Name = name; diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs index e49db38ff7a..5e04a862870 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs @@ -14,6 +14,8 @@ namespace Microsoft.Testing.Platform.CommandLine; internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider { public const string HelpOptionKey = "help"; + public const string HelpOptionShortcut1 = "?"; + public const string HelpOptionShortcut2 = "h"; public const string InfoOptionKey = "info"; public const string DiagnosticOptionKey = "diagnostic"; public const string DiagnosticOutputFilePrefixOptionKey = "diagnostic-output-fileprefix"; @@ -57,6 +59,8 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider new(ExitOnProcessExitOptionKey, PlatformResources.PlatformCommandLineExitOnProcessExitOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true), // Hidden options + new(HelpOptionShortcut1, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), + new(HelpOptionShortcut2, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), new(ServerOptionKey, PlatformResources.PlatformCommandLineServerOptionDescription, ArgumentArity.ZeroOrOne, true, isBuiltIn: true), new(PortOptionKey, PlatformResources.PlatformCommandLinePortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), new(ClientPortOptionKey, PlatformResources.PlatformCommandLineClientPortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), From 35a95194a8715d59bdcb9a0a71b60a06ca0f4753 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 11:09:41 +0200 Subject: [PATCH 2/7] renaming --- .../CommandLine/CommandLineHandler.cs | 2 +- .../CommandLine/PlatformCommandLineProvider.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs index 6734f2d9660..ece73c018a0 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs @@ -227,7 +227,7 @@ public bool TryGetOptionArgumentList(string optionName, [NotNullWhen(true)] out public Task IsEnabledAsync() => Task.FromResult(false); - public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortcut1) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortcut2); + public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName1) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName2); public bool IsInfoInvoked() => IsOptionSet(PlatformCommandLineProvider.InfoOptionKey); diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs index 5e04a862870..25bf6f4cf06 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs @@ -14,8 +14,8 @@ namespace Microsoft.Testing.Platform.CommandLine; internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider { public const string HelpOptionKey = "help"; - public const string HelpOptionShortcut1 = "?"; - public const string HelpOptionShortcut2 = "h"; + public const string HelpOptionShortName1 = "?"; + public const string HelpOptionShortName2 = "h"; public const string InfoOptionKey = "info"; public const string DiagnosticOptionKey = "diagnostic"; public const string DiagnosticOutputFilePrefixOptionKey = "diagnostic-output-fileprefix"; @@ -59,8 +59,8 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider new(ExitOnProcessExitOptionKey, PlatformResources.PlatformCommandLineExitOnProcessExitOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true), // Hidden options - new(HelpOptionShortcut1, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), - new(HelpOptionShortcut2, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), + new(HelpOptionShortName1, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), + new(HelpOptionShortName2, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), new(ServerOptionKey, PlatformResources.PlatformCommandLineServerOptionDescription, ArgumentArity.ZeroOrOne, true, isBuiltIn: true), new(PortOptionKey, PlatformResources.PlatformCommandLinePortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), new(ClientPortOptionKey, PlatformResources.PlatformCommandLineClientPortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), From 0e68b330b8c7fe65e398b1c8383b96b6e5d7edf1 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 11:20:08 +0200 Subject: [PATCH 3/7] added tests --- .../HelpInfoTests.cs | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs index c717e1f9d5a..88fd5009038 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -49,6 +49,38 @@ Execute a .NET Test Application. testHostResult.AssertOutputMatches(wildcardMatchPattern); } + [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] + public async Task HelpShortName1_WhenNoExtensionRegistered_OutputDefaultHelpContent(string tfm) + { + var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.NoExtensionTargetAssetPath, TestAssetFixture.NoExtensionAssetName, tfm); + TestHostResult testHostResult = await testHost.ExecuteAsync("--h"); + + testHostResult.AssertExitCodeIs(ExitCodes.Success); + + const string wildcardMatchPattern = $""" +.NET Testing Platform v* +Usage {TestAssetFixture.NoExtensionAssetName}* [option providers] [extension option providers] +Execute a .NET Test Application. +Options: + --diagnostic Enable the diagnostic logging. The default log level is 'Trace'. The file will be written in the output directory with the name log_[MMddHHssfff].diag + --diagnostic-filelogger-synchronouswrite Force the built-in file logger to write the log synchronously. Useful for scenario where you don't want to lose any log (i.e. in case of crash). Note that this is slowing down the test execution. + --diagnostic-output-directory Output directory of the diagnostic logging, if not specified the file will be generated inside the default 'TestResults' directory. + --diagnostic-output-fileprefix Prefix for the log file name that will replace '[log]_.' + --diagnostic-verbosity Define the level of the verbosity for the --diagnostic. The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', and 'Critical' + --exit-on-process-exit Exit the test process if dependent process exits. PID must be provided. + --help Show the command line help. + --ignore-exit-code Do not report non successful exit value for specific exit codes (e.g. '--ignore-exit-code 8;9' ignore exit code 8 and 9 and will return 0 in these case) + --info Display .NET test application information. + --list-tests List available tests. + --minimum-expected-tests Specifies the minimum number of tests that are expected to run. + --results-directory The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the test application. +Extension options: + --treenode-filter Use a tree filter to filter down the tests to execute +"""; + + testHostResult.AssertOutputMatches(wildcardMatchPattern); + } + [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] public async Task Help_WhenNoExtensionRegisteredAndUnknownOptionIsSpecified_OutputDefaultHelpContentAndUnknownOption(string tfm) { @@ -250,6 +282,50 @@ Execute a .NET Test Application. testHostResult.AssertOutputMatches(wildcardPattern); } + [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] + public async Task HelpShortName2_WithAllExtensionsRegistered_OutputFullHelpContent(string tfm) + { + var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.AllExtensionsTargetAssetPath, TestAssetFixture.AllExtensionsAssetName, tfm); + TestHostResult testHostResult = await testHost.ExecuteAsync("--?"); + + testHostResult.AssertExitCodeIs(ExitCodes.Success); + + string wildcardPattern = $""" +.NET Testing Platform v* +Usage {TestAssetFixture.AllExtensionsAssetName}* [option providers] [extension option providers] +Execute a .NET Test Application. +Options: + --diagnostic Enable the diagnostic logging. The default log level is 'Trace'. The file will be written in the output directory with the name log_[MMddHHssfff].diag + --diagnostic-filelogger-synchronouswrite Force the built-in file logger to write the log synchronously. Useful for scenario where you don't want to lose any log (i.e. in case of crash). Note that this is slowing down the test execution. + --diagnostic-output-directory Output directory of the diagnostic logging, if not specified the file will be generated inside the default 'TestResults' directory. + --diagnostic-output-fileprefix Prefix for the log file name that will replace '[log]_.' + --diagnostic-verbosity Define the level of the verbosity for the --diagnostic. The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', and 'Critical' + --exit-on-process-exit Exit the test process if dependent process exits. PID must be provided. + --help Show the command line help. + --ignore-exit-code Do not report non successful exit value for specific exit codes (e.g. '--ignore-exit-code 8;9' ignore exit code 8 and 9 and will return 0 in these case) + --info Display .NET test application information. + --list-tests List available tests. + --minimum-expected-tests Specifies the minimum number of tests that are expected to run. + --results-directory The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the test application. + --retry-failed-tests Enable retry failed tests + --retry-failed-tests-max-percentage Disable retry mechanism if the percentage of failed tests is greater than the specified value + --retry-failed-tests-max-tests Disable retry mechanism if the number of failed tests is greater than the specified value +Extension options: + --crashdump [net6.0+ only] Generate a dump file if the test process crashes + --crashdump-filename Specify the name of the dump file + --crashdump-type Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' or 'Full'. Default type is 'Full'. For more information visit https://learn.microsoft.com/dotnet/core/diagnostics/collect-dumps-crash#types-of-mini-dumps + --hangdump Generate a dump file if the test process hangs + --hangdump-filename Specify the name of the dump file + --hangdump-timeout Specify the timeout after which the dump will be generated. The timeout value is specified in one of the following formats: 1.5h, 1.5hour, 1.5hours, 90m, 90min, 90minute, 90minutes 5400s, 5400sec, 5400second, 5400seconds. Default is 30m. + --hangdump-type Specify the type of the dump. Valid values are 'Mini', 'Heap', 'Triage' (only available in .NET 6+) or 'Full'. Default type is 'Full' + --report-trx Enable generating TRX report + --report-trx-filename The name of the generated TRX report + --treenode-filter Use a tree filter to filter down the tests to execute +"""; + + testHostResult.AssertOutputMatches(wildcardPattern); + } + [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] public async Task Info_WithAllExtensionsRegistered_OutputFullInfoContent(string tfm) { From b2de1500ed6e781f475e84d0d65ba65d3fb0e3c2 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 11:53:08 +0200 Subject: [PATCH 4/7] using only ? --- .../CommandLine/CommandLineHandler.cs | 2 +- .../CommandLine/PlatformCommandLineProvider.cs | 6 ++---- .../HelpInfoTests.cs | 8 ++++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs index ece73c018a0..6ad8d5cfa86 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs @@ -227,7 +227,7 @@ public bool TryGetOptionArgumentList(string optionName, [NotNullWhen(true)] out public Task IsEnabledAsync() => Task.FromResult(false); - public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName1) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName2); + public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName); public bool IsInfoInvoked() => IsOptionSet(PlatformCommandLineProvider.InfoOptionKey); diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs index 25bf6f4cf06..f5a2e18a4ea 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs @@ -14,8 +14,7 @@ namespace Microsoft.Testing.Platform.CommandLine; internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider { public const string HelpOptionKey = "help"; - public const string HelpOptionShortName1 = "?"; - public const string HelpOptionShortName2 = "h"; + public const string HelpOptionShortName = "?"; public const string InfoOptionKey = "info"; public const string DiagnosticOptionKey = "diagnostic"; public const string DiagnosticOutputFilePrefixOptionKey = "diagnostic-output-fileprefix"; @@ -59,8 +58,7 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider new(ExitOnProcessExitOptionKey, PlatformResources.PlatformCommandLineExitOnProcessExitOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true), // Hidden options - new(HelpOptionShortName1, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), - new(HelpOptionShortName2, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), + new(HelpOptionShortName, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), new(ServerOptionKey, PlatformResources.PlatformCommandLineServerOptionDescription, ArgumentArity.ZeroOrOne, true, isBuiltIn: true), new(PortOptionKey, PlatformResources.PlatformCommandLinePortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), new(ClientPortOptionKey, PlatformResources.PlatformCommandLineClientPortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs index 88fd5009038..9c51bbd3321 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -50,10 +50,10 @@ Execute a .NET Test Application. } [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] - public async Task HelpShortName1_WhenNoExtensionRegistered_OutputDefaultHelpContent(string tfm) + public async Task HelpShortName_WhenNoExtensionRegistered_OutputDefaultHelpContent(string tfm) { var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.NoExtensionTargetAssetPath, TestAssetFixture.NoExtensionAssetName, tfm); - TestHostResult testHostResult = await testHost.ExecuteAsync("--h"); + TestHostResult testHostResult = await testHost.ExecuteAsync("--?"); testHostResult.AssertExitCodeIs(ExitCodes.Success); @@ -283,10 +283,10 @@ Execute a .NET Test Application. } [ArgumentsProvider(nameof(TargetFrameworks.All), typeof(TargetFrameworks))] - public async Task HelpShortName2_WithAllExtensionsRegistered_OutputFullHelpContent(string tfm) + public async Task HelpShortName_WithAllExtensionsRegistered_OutputFullHelpContent(string tfm) { var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.AllExtensionsTargetAssetPath, TestAssetFixture.AllExtensionsAssetName, tfm); - TestHostResult testHostResult = await testHost.ExecuteAsync("--?"); + TestHostResult testHostResult = await testHost.ExecuteAsync("-?"); testHostResult.AssertExitCodeIs(ExitCodes.Success); From 4cc6a664a6c72a4037d45214dede382ca6671fb3 Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 12:03:32 +0200 Subject: [PATCH 5/7] fixing info test --- .../HelpInfoTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs index 9c51bbd3321..416912aaff0 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -137,6 +137,10 @@ .NET Testing Platform v.+ \[.+\] Version: .+ Description: Microsoft Testing Platform command line provider Options: + --? + Arity: 0 + Hidden: True + Description: Show the command line help. --client-host Arity: 1 Hidden: True @@ -347,6 +351,10 @@ .NET Testing Platform v* [*] Version: * Description: Microsoft Testing Platform command line provider Options: + --? + Arity: 0 + Hidden: True + Description: Show the command line help. --client-host Arity: 1 Hidden: True From 2c6d1407a2203f4f7cb3182cfdbb59fe7e76262e Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 13:09:12 +0200 Subject: [PATCH 6/7] fixed --- .../HelpInfoTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs index 416912aaff0..05e26d2e534 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -137,10 +137,10 @@ .NET Testing Platform v.+ \[.+\] Version: .+ Description: Microsoft Testing Platform command line provider Options: - --? + --\? Arity: 0 Hidden: True - Description: Show the command line help. + Description: Show the command line help\. --client-host Arity: 1 Hidden: True From fbe12a5c451e62498bb85dc0e9d5baa5767b2fab Mon Sep 17 00:00:00 2001 From: Enji Eid Date: Mon, 12 Aug 2024 13:45:35 +0200 Subject: [PATCH 7/7] rename option --- .../CommandLine/CommandLineHandler.cs | 2 +- .../CommandLine/PlatformCommandLineProvider.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs index 6ad8d5cfa86..dbfd7ec7da7 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineHandler.cs @@ -227,7 +227,7 @@ public bool TryGetOptionArgumentList(string optionName, [NotNullWhen(true)] out public Task IsEnabledAsync() => Task.FromResult(false); - public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionShortName); + public bool IsHelpInvoked() => IsOptionSet(PlatformCommandLineProvider.HelpOptionKey) || IsOptionSet(PlatformCommandLineProvider.HelpOptionQuestionMark); public bool IsInfoInvoked() => IsOptionSet(PlatformCommandLineProvider.InfoOptionKey); diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs index f5a2e18a4ea..7a945741eb9 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs @@ -14,7 +14,7 @@ namespace Microsoft.Testing.Platform.CommandLine; internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider { public const string HelpOptionKey = "help"; - public const string HelpOptionShortName = "?"; + public const string HelpOptionQuestionMark = "?"; public const string InfoOptionKey = "info"; public const string DiagnosticOptionKey = "diagnostic"; public const string DiagnosticOutputFilePrefixOptionKey = "diagnostic-output-fileprefix"; @@ -58,7 +58,7 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider new(ExitOnProcessExitOptionKey, PlatformResources.PlatformCommandLineExitOnProcessExitOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true), // Hidden options - new(HelpOptionShortName, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), + new(HelpOptionQuestionMark, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true), new(ServerOptionKey, PlatformResources.PlatformCommandLineServerOptionDescription, ArgumentArity.ZeroOrOne, true, isBuiltIn: true), new(PortOptionKey, PlatformResources.PlatformCommandLinePortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true), new(ClientPortOptionKey, PlatformResources.PlatformCommandLineClientPortOptionDescription, ArgumentArity.ExactlyOne, true, isBuiltIn: true),