mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-18 21:08:15 +08:00
New doc theme (#387)
This commit is contained in:
@ -2,8 +2,6 @@ Title: Prompts
|
||||
Order: 5
|
||||
---
|
||||
|
||||
<h1>Sections</h1>
|
||||
|
||||
<ul>
|
||||
@foreach (IDocument child in OutputPages.GetChildrenOf(Document))
|
||||
{
|
||||
|
@ -5,14 +5,13 @@ Order: 3
|
||||
The `MultiSelectionPrompt` can be used when you want the user to select
|
||||
one or many items from a provided list.
|
||||
|
||||
<img src="../assets/images/multiselection.gif" style="width: 100%;" />
|
||||

|
||||
|
||||
<div class="alert alert-warning" role="alert" style="margin-top:20px;">
|
||||
<i class="fas fa-exclamation-triangle icon-web"></i> The use of prompts
|
||||
<?# Alert ?> The use of prompts
|
||||
insides status or progress displays is not supported.
|
||||
</div>
|
||||
<?#/ Alert ?>
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
```csharp
|
||||
// Ask for the user's favorite fruits
|
||||
@ -37,4 +36,4 @@ foreach (string fruit in fruits)
|
||||
{
|
||||
AnsiConsole.WriteLine(fruit);
|
||||
}
|
||||
```
|
||||
```
|
||||
|
@ -5,14 +5,14 @@ Order: 1
|
||||
The `SelectionPrompt` can be used when you want the user to select
|
||||
a single item from a provided list.
|
||||
|
||||
<img src="../assets/images/selection.gif" style="width: 100%;" />
|
||||

|
||||
|
||||
<div class="alert alert-warning" role="alert" style="margin-top:20px;">
|
||||
<i class="fas fa-exclamation-triangle icon-web"></i> Using prompts inside
|
||||
<?# Alert ?>
|
||||
Using prompts inside
|
||||
status or progress displays, are not supported.
|
||||
</div>
|
||||
<?#/ Alert ?>
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
```csharp
|
||||
// Ask for the user's favorite fruit
|
||||
|
@ -6,12 +6,12 @@ RedirectFrom: prompt
|
||||
Sometimes you want to get some input from the user, and for this
|
||||
you can use the `Prompt<TResult>`.
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fas fa-exclamation-triangle icon-web"></i> The use of prompts
|
||||
<?# Alert ?>
|
||||
The use of prompts
|
||||
insides status or progress displays is not supported.
|
||||
</div>
|
||||
<?#/ Alert ?>
|
||||
|
||||
# Confirmation
|
||||
## Confirmation
|
||||
|
||||
```csharp
|
||||
if (!AnsiConsole.Confirm("Run example?"))
|
||||
@ -24,7 +24,7 @@ if (!AnsiConsole.Confirm("Run example?"))
|
||||
Run example? [y/n] (y): _
|
||||
```
|
||||
|
||||
# Simple
|
||||
## Simple
|
||||
|
||||
```csharp
|
||||
// Ask for the user's name
|
||||
@ -39,7 +39,7 @@ What's your name? Patrik
|
||||
What's your age? 37
|
||||
```
|
||||
|
||||
# Choices
|
||||
## Choices
|
||||
|
||||
```csharp
|
||||
var fruit = AnsiConsole.Prompt(
|
||||
@ -55,7 +55,7 @@ var fruit = AnsiConsole.Prompt(
|
||||
What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
|
||||
```
|
||||
|
||||
# Validation
|
||||
## Validation
|
||||
|
||||
```csharp
|
||||
var age = AnsiConsole.Prompt(
|
||||
@ -79,7 +79,7 @@ Too high
|
||||
What's the secret number? _
|
||||
```
|
||||
|
||||
# Secrets
|
||||
## Secrets
|
||||
|
||||
```csharp
|
||||
var password = AnsiConsole.Prompt(
|
||||
@ -92,7 +92,7 @@ var password = AnsiConsole.Prompt(
|
||||
Enter password: ************_
|
||||
```
|
||||
|
||||
# Optional
|
||||
## Optional
|
||||
|
||||
```csharp
|
||||
var color = AnsiConsole.Prompt(
|
||||
|
Reference in New Issue
Block a user