Class Prompt
Tiny interactive prompts: yes/no Confirm, free-text
Ask, arrow-key Select. All zero-dependency, AOT-clean.
Without ANSI, Select degrades to a numbered list with
ReadLine().
public static class Prompt
- Inheritance
-
Prompt
- Inherited Members
Methods
Ask(string, string?, Color?)
Free-text prompt. Reads a full line. If defaultValue
is set it appears in the prompt as [default] and is returned
when the user presses Enter on an empty input.
public static string Ask(string question, string? defaultValue = null, Color? color = null)
Parameters
Returns
Confirm(string, bool, Color?)
Yes/no question. Reads a single keystroke (no Enter required).
Pressing Enter accepts defaultYes; any key
other than y/Y/n/N is ignored.
public static bool Confirm(string question, bool defaultYes = false, Color? color = null)
Parameters
Returns
Select(string, string[], int, Color?)
Arrow-key menu. Returns the index of the chosen option. Up/Down
to move; Enter to select. The active option is prefixed with
> and rendered in color + bold.
Without ANSI, falls back to a numbered list read via
ReadLine().
public static int Select(string question, string[] options, int initialIndex = 0, Color? color = null)