Allow custom instructions for prompts

Closes #229
This commit is contained in:
Patrik Svensson
2021-03-14 23:35:08 +01:00
committed by Phil Scott
parent 9502aaf2b9
commit c2bab0ebf8
9 changed files with 105 additions and 9 deletions

View File

@ -44,6 +44,16 @@ namespace Spectre.Console
/// </summary>
public Style? HighlightStyle { get; set; }
/// <summary>
/// Gets or sets the text that will be displayed if there are more choices to show.
/// </summary>
public string? MoreChoicesText { get; set; }
/// <summary>
/// Gets or sets the text that instructs the user of how to select items.
/// </summary>
public string? InstructionsText { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not
/// at least one selection is required.
@ -77,8 +87,11 @@ namespace Spectre.Console
}
var converter = Converter ?? TypeConverterHelper.ConvertToString;
var list = new RenderableMultiSelectionList<T>(
console, Title, PageSize, Choices,
Selected, converter, HighlightStyle,
MoreChoicesText, InstructionsText);
var list = new RenderableMultiSelectionList<T>(console, Title, PageSize, Choices, Selected, converter, HighlightStyle);
using (new RenderHookScope(console, list))
{
console.Cursor.Hide();