Phil Scott c2da268129
Docs redesign (#728)
* 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
2022-02-14 18:44:25 +01:00

74 lines
1.4 KiB
Markdown

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>`.
<?# AsciiCast cast="input" /?>
<?# Alert ?>
The use of prompts
insides status or progress displays is not supported.
<?#/ Alert ?>
## Confirmation
<?# Example symbol="M:Prompt.Program.AskConfirmation" project="Prompt" /?>
```text
Run prompt example? [y/n] (y): _
```
## Simple
<?# Example symbol="M:Prompt.Program.AskName" project="Prompt" /?>
```text
What's your name? Patrik
What's your age? 37
```
## Choices
<?# Example symbol="M:Prompt.Program.AskFruit" project="Prompt" /?>
```text
What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
```
## Validation
<?# Example symbol="M:Prompt.Program.AskAge" project="Prompt" /?>
```text
What's the secret number? 32
Too low
What's the secret number? 102
Too high
What's the secret number? _
```
## Secrets
<?# Example symbol="M:Prompt.Program.AskPassword" project="Prompt" /?>
```text
Enter password: ************_
```
## Optional
<?# Example symbol="M:Prompt.Program.AskColor" project="Prompt" /?>
```text
[Optional] Favorite color? _
```