using System; namespace Spectre.Console { /// /// Contains extension methods for . /// public static partial class AnsiConsoleExtensions { /// /// Displays a prompt to the user. /// /// The prompt result type. /// The console. /// The prompt to display. /// The prompt input result. public static T Prompt(this IAnsiConsole console, IPrompt prompt) { if (prompt is null) { throw new ArgumentNullException(nameof(prompt)); } return prompt.Show(console); } /// /// Displays a prompt to the user. /// /// The prompt result type. /// The console. /// The prompt markup text. /// The prompt input result. public static T Ask(this IAnsiConsole console, string prompt) { return new TextPrompt(prompt).Show(console); } /// /// Displays a prompt with two choices, yes or no. /// /// The console. /// The prompt markup text. /// Specifies the default answer. /// true if the user selected "yes", otherwise false. public static bool Confirm(this IAnsiConsole console, string prompt, bool defaultValue = true) { return new ConfirmationPrompt(prompt) { DefaultValue = defaultValue, } .Show(console); } } }