mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00

* Adding a dark mode * Adding reference for types to summary pages * Adding API Reference * Adding modifiers to methods/fields/etc * Minimizing files input * Caching a lot of the output pages * Cache only for each execution * Adding API references to existing docs
1.4 KiB
1.4 KiB
Title: Text prompt Order: 0 RedirectFrom: prompt Description: "Spectre.Console has multiple input functions for helping receive strongly typed input from a user." Highlights: - Confirmation. - Strongly typed input. - Input restricted to specific items. - Secrets such as passwords or keys.
Sometimes you want to get some input from the user, and for this
you can use the Prompt<TResult>
.
The use of prompts insides status or progress displays is not supported.
Confirmation
Run prompt example? [y/n] (y): _
Simple
What's your name? Patrik
What's your age? 37
Choices
What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
Validation
What's the secret number? 32
Too low
What's the secret number? 102
Too high
What's the secret number? _
Secrets
Enter password: ************_
Optional
[Optional] Favorite color? _