mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 08:52: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>
|
/// </summary>
|
||||||
public bool ShowDefaultValue { get; set; } = true;
|
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>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ConfirmationPrompt"/> class.
|
/// Initializes a new instance of the <see cref="ConfirmationPrompt"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -67,6 +73,7 @@ public sealed class ConfirmationPrompt : IPrompt<bool>
|
|||||||
.AddChoice(No);
|
.AddChoice(No);
|
||||||
|
|
||||||
var result = await prompt.ShowAsync(console, cancellationToken).ConfigureAwait(false);
|
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