Skip to content

Commit

Permalink
Ensure --prompt-on-exit option backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
i2van committed Sep 3, 2024
1 parent 1025ba4 commit 1ba046d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Hourglass/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static string Usage
public string? ParseErrorMessage { get; private set; }

/// <summary>
/// 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.
/// </summary>
public bool ShouldShowUsage { get; private set; }

Expand Down Expand Up @@ -471,10 +471,11 @@ private static CommandLineArguments GetCommandLineArguments(IEnumerable<string>
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(
Expand Down Expand Up @@ -1218,14 +1219,14 @@ private static bool IsSwitch(string arg)
/// Unescapes a command-line value.
/// </summary>
/// <remarks>
/// 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 `'`.
/// </remarks>
/// <param name="value">An escaped value string.</param>
/// <returns>The unescaped value.</returns>
private static string UnescapeValue(string value)
{
return !value.StartsWith("'") ? value : value.Substring(1);
return value.StartsWith("'") ? value.Substring(1) : value;
}

/// <summary>
Expand Down

0 comments on commit 1ba046d

Please sign in to comment.