mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-14 16:02:50 +08:00
Merge pull request #1151 from MartinZikmund/dev/mazi/confirmation-insensitive
This commit is contained in:
commit
92318ce1fb
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user