mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-07 21:17:15 +08:00
Allow Confirmation Prompt Styling (#1210)
* Allow Confirmation Prompt Styling * Remove style null check Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> * Remove style null coalesce Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> * Update comment Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> * Remove style null check Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> * Update comment Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> * Remove style null coalesce Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com> --------- Co-authored-by: Cédric Luthi <cedric.luthi@gmail.com>
This commit is contained in:
@ -39,6 +39,16 @@ public sealed class ConfirmationPrompt : IPrompt<bool>
|
||||
/// </summary>
|
||||
public bool ShowDefaultValue { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style in which the default value is displayed. Defaults to green when <see langword="null"/>.
|
||||
/// </summary>
|
||||
public Style? DefaultValueStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style in which the list of choices is displayed. Defaults to blue when <see langword="null"/>.
|
||||
/// </summary>
|
||||
public Style? ChoicesStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the string comparer to use when comparing user input
|
||||
/// against Yes/No choices.
|
||||
@ -72,8 +82,10 @@ public sealed class ConfirmationPrompt : IPrompt<bool>
|
||||
.InvalidChoiceMessage(InvalidChoiceMessage)
|
||||
.ValidationErrorMessage(InvalidChoiceMessage)
|
||||
.ShowChoices(ShowChoices)
|
||||
.ChoicesStyle(ChoicesStyle)
|
||||
.ShowDefaultValue(ShowDefaultValue)
|
||||
.DefaultValue(DefaultValue ? Yes : No)
|
||||
.DefaultValueStyle(DefaultValueStyle)
|
||||
.AddChoice(Yes)
|
||||
.AddChoice(No);
|
||||
|
||||
|
Reference in New Issue
Block a user