(#460) added an overload to AnsiConsole.Ask

that takes an additional default value.
This commit is contained in:
Nils Andresen
2021-06-23 15:29:39 +02:00
committed by Patrik Svensson
parent c9b178ac96
commit b92827ce3d
2 changed files with 26 additions and 1 deletions

View File

@ -34,6 +34,20 @@ namespace Spectre.Console
return new TextPrompt<T>(prompt).Show(Console);
}
/// <summary>
/// Displays a prompt to the user with a given default.
/// </summary>
/// <typeparam name="T">The prompt result type.</typeparam>
/// <param name="prompt">The prompt markup text.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns>The prompt input result.</returns>
public static T Ask<T>(string prompt, T defaultValue)
{
return new TextPrompt<T>(prompt)
.DefaultValue(defaultValue)
.Show(Console);
}
/// <summary>
/// Displays a prompt with two choices, yes or no.
/// </summary>