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
This commit is contained in:
Phil Scott
2022-02-14 12:44:25 -05:00
committed by GitHub
parent 74a2e10ff0
commit c2da268129
147 changed files with 4112 additions and 6897 deletions

View File

@ -12,8 +12,7 @@ one or many items from a provided list.
<?# AsciiCast cast="multi-selection" /?>
<?# Alert ?> The use of prompts
insides status or progress displays is not supported.
<?# Alert ?> The use of prompts inside status or progress displays is not supported.
<?#/ Alert ?>
## Usage

View File

@ -1,6 +1,9 @@
Title: Selection
Order: 1
Description: "The **SelectionPrompt** can be used when you want the user to select a single item from a provided list."
Reference:
- T:Spectre.Console.SelectionPrompt`1
- M:Spectre.Console.AnsiConsole.Prompt``1(Spectre.Console.IPrompt{``0})
---
The `SelectionPrompt` can be used when you want the user to select

View File

@ -21,26 +21,15 @@ you can use the `Prompt<TResult>`.
## Confirmation
```csharp
if (!AnsiConsole.Confirm("Run example?"))
{
return;
}
```
<?# Example symbol="M:Prompt.Program.AskConfirmation" project="Prompt" /?>
```text
Run example? [y/n] (y): _
Run prompt example? [y/n] (y): _
```
## Simple
```csharp
// Ask for the user's name
string name = AnsiConsole.Ask<string>("What's your [green]name[/]?");
// Ask for the user's age
int age = AnsiConsole.Ask<int>("What's your [green]age[/]?");
```
<?# Example symbol="M:Prompt.Program.AskName" project="Prompt" /?>
```text
What's your name? Patrik
@ -49,15 +38,7 @@ What's your age? 37
## Choices
```csharp
var fruit = AnsiConsole.Prompt(
new TextPrompt<string>("What's your [green]favorite fruit[/]?")
.InvalidChoiceMessage("[red]That's not a valid fruit[/]")
.DefaultValue("Orange")
.AddChoice("Apple")
.AddChoice("Banana")
.AddChoice("Orange"));
```
<?# Example symbol="M:Prompt.Program.AskFruit" project="Prompt" /?>
```text
What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
@ -65,19 +46,7 @@ What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
## Validation
```csharp
var age = AnsiConsole.Prompt(
new TextPrompt<int>("What's the secret number?")
.Validate(age =>
{
return age switch
{
< 99 => ValidationResult.Error("[red]Too low[/]"),
> 99 => ValidationResult.Error("[red]Too high[/]"),
_ => ValidationResult.Success(),
};
}));
```
<?# Example symbol="M:Prompt.Program.AskAge" project="Prompt" /?>
```text
What's the secret number? 32
@ -89,12 +58,8 @@ What's the secret number? _
## Secrets
```csharp
var password = AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]password[/]")
.PromptStyle("red")
.Secret());
```
<?# Example symbol="M:Prompt.Program.AskPassword" project="Prompt" /?>
```text
Enter password: ************_
@ -102,11 +67,7 @@ Enter password: ************_
## Optional
```csharp
var color = AnsiConsole.Prompt(
new TextPrompt<string>("[grey][[Optional]][/] [green]Favorite color[/]?")
.AllowEmpty());
```
<?# Example symbol="M:Prompt.Program.AskColor" project="Prompt" /?>
```text
[Optional] Favorite color? _