Merge pull request #1151 from MartinZikmund/dev/mazi/confirmation-insensitive

This commit is contained in:
Patrik Svensson 2023-02-04 13:41:14 +01:00 committed by GitHub
commit 92318ce1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,12 @@ public sealed class ConfirmationPrompt : IPrompt<bool>
/// </summary>
public bool ShowDefaultValue { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the confirmation
/// should use case insensitive matching.
/// </summary>
public bool CaseInsensitive { get; set; } = true;
/// <summary>
/// Initializes a new instance of the <see cref="ConfirmationPrompt"/> class.
/// </summary>
@ -67,6 +73,7 @@ public sealed class ConfirmationPrompt : IPrompt<bool>
.AddChoice(No);
var result = await prompt.ShowAsync(console, cancellationToken).ConfigureAwait(false);
return result == Yes;
return Yes.ToString().Equals(result.ToString(), CaseInsensitive ? StringComparison.CurrentCultureIgnoreCase : StringComparison.CurrentCulture);
}
}