From 1ba046d121d54dd230385067b652eb59fe420c8e Mon Sep 17 00:00:00 2001 From: Ivan Ivon Date: Tue, 3 Sep 2024 13:10:50 +0300 Subject: [PATCH] Ensure --prompt-on-exit option backward compatibility --- Hourglass/CommandLineArguments.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Hourglass/CommandLineArguments.cs b/Hourglass/CommandLineArguments.cs index 47d3b92..a636b5a 100644 --- a/Hourglass/CommandLineArguments.cs +++ b/Hourglass/CommandLineArguments.cs @@ -51,7 +51,7 @@ public static string Usage public string? ParseErrorMessage { get; private set; } /// - /// Gets a value indicating whether command-line usage information should be showed to the user. + /// Gets a value indicating whether command-line usage information should be shown to the user. /// public bool ShouldShowUsage { get; private set; } @@ -471,10 +471,11 @@ private static CommandLineArguments GetCommandLineArguments(IEnumerable argumentsBasedOnFactoryDefaults.IsFullScreen = isFullScreen; break; - case "--prompt-on-exit": + case "--prompt-on-exit": // Backward compatibility. case "--prompt-on-close": case "-o": case "/o": + ThrowIfDuplicateSwitch(specifiedSwitches, "--prompt-on-exit"); // Backward compatibility. ThrowIfDuplicateSwitch(specifiedSwitches, "--prompt-on-close"); bool promptOnExit = GetBoolValue( @@ -1218,14 +1219,14 @@ private static bool IsSwitch(string arg) /// Unescapes a command-line value. /// /// - /// A value is any command-line argument not beginning with '-'. If the user must specify a command-line value - /// that begins with '-', the user must escape the '-' with '''. + /// A value is any command-line argument not beginning with `-`. If the user must specify a command-line value + /// that begins with `-`, the user must escape the `-` with `'`. /// /// An escaped value string. /// The unescaped value. private static string UnescapeValue(string value) { - return !value.StartsWith("'") ? value : value.Substring(1); + return value.StartsWith("'") ? value.Substring(1) : value; } ///