Gary McDougall eb02c3d534
Custom mask for secret (#970)
* Masking Character added, not yet used.

* Setting the masking character can be chained with other extensions.

* Added string extension for masking, and replaced hardcoded asterisks.

* Check if mask is null first.

* Fixed Typo in previous test and added new test for custom masks.

* Added tests for masking with null character

* Added docs and example.

* Adjusted extensions so that Mask is integrated into Secret extension. Updated Exampls and Tests accordingly
2022-09-26 20:34:41 +02:00

1.7 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: ************_

Masks

Enter password: ------------_

You can utilize a null character to completely hide input.

Enter password: _

Optional

[Optional] Favorite color? _