SecretPrompt
ConsoleMonster.Interactive
A secret (password, token): masked or hidden while typed, with Ctrl+R to reveal it for a moment, required by default. The answer never appears in summaries, logs or presets.
Inheritance
- Prompt<string>
- SecretPrompt
Usage
Explore 36 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 18
- Extension method SecretPrompt.AllowReveal
- Extension method SecretPrompt.Default
- Extension method SecretPrompt.Description
- Extension method SecretPrompt.Display
- Extension method SecretPrompt.MinLength
- Extension method SecretPrompt.ParameterName
- Extension method SecretPrompt.Required
- Extension method SecretPrompt.Title
- Extension method SecretPrompt.Validate
- Method SecretPromptFluent.AllowReveal
- Method SecretPromptFluent.Default
- Method SecretPromptFluent.Description
- Method SecretPromptFluent.Display
- Method SecretPromptFluent.MinLength
- Method SecretPromptFluent.ParameterName
- Method SecretPromptFluent.Required
- Method SecretPromptFluent.Title
- Method SecretPromptFluent.Validate
Accepted by parameters 18
- Extension method SecretPrompt.AllowReveal
- Extension method SecretPrompt.Default
- Extension method SecretPrompt.Description
- Extension method SecretPrompt.Display
- Extension method SecretPrompt.MinLength
- Extension method SecretPrompt.ParameterName
- Extension method SecretPrompt.Required
- Extension method SecretPrompt.Title
- Extension method SecretPrompt.Validate
- Method SecretPromptFluent.AllowReveal
- Method SecretPromptFluent.Default
- Method SecretPromptFluent.Description
- Method SecretPromptFluent.Display
- Method SecretPromptFluent.MinLength
- Method SecretPromptFluent.ParameterName
- Method SecretPromptFluent.Required
- Method SecretPromptFluent.Title
- Method SecretPromptFluent.Validate
Constructors
Methods
public override string Describe(string value) #The answer as text, for the summary line left in the scrollback.
Parameters
- value string
- The answer.
Returns
string The text.public SecureString ShowSecure(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Asks for the secret and returns it as a read-only SecureString, for APIs that take one (credentials, certificate stores). The answer is edited as text first, so this is a type for those APIs, not stronger protection than Prompt<T>.Show.
Parameters
- options ConsoleMonster.Interactive.InteractiveOptions? = null
- Options.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the prompt.
Returns
SecureString The secret.Inherited Methods
public virtual string Show(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
stringpublic Task<string> ShowAsync(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
Task<string>public IWidget Snapshot(InteractiveOptions? options = null) #Parameters
- options InteractiveOptions? = null
Returns
IWidgetpublic bool TryShow(out string value, InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- value string
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
boolProperties
public Func<string, string?>? Validator { get; set; } #Fluent("Validate")A validator: returns an error message, or null.
Inherited Properties
public string Title { get; set; } #public string? Description { get; set; } #public string? ParameterName { get; set; } #public bool HasDefault { get; } #Extension Methods
public static SecretPrompt AllowReveal(SecretPrompt secretPrompt, bool value = true) #Sets SecretPrompt.AllowReveal: Whether Ctrl+R can reveal the typed text.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
secretPrompt.AllowReveal = value; secretPrompt.AllowReveal(value);public static SecretPrompt Default(SecretPrompt secretPrompt, string value) #Sets Prompt<string>.Default: The default answer: pre-selected, accepted with Enter, and returned in non-interactive sessions.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.Default = value; secretPrompt.Default(value);public static SecretPrompt Description(SecretPrompt secretPrompt, string? value) #Sets Prompt<string>.Description: Help text under the question.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.Description = value; secretPrompt.Description(value);public static SecretPrompt Display(SecretPrompt secretPrompt, SecretDisplay value) #Sets SecretPrompt.Display: How the secret is shown while typed.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value ConsoleMonster.Interactive.SecretDisplay
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.Display = value; secretPrompt.Display(value);public static SecretPrompt MinLength(SecretPrompt secretPrompt, int value) #Sets SecretPrompt.MinLength: The fewest characters accepted.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.MinLength = value; secretPrompt.MinLength(value);public static SecretPrompt ParameterName(SecretPrompt secretPrompt, string? value) #Sets Prompt<string>.ParameterName: The parameter that supplies this value non-interactively (-Domain, --domain); named in the non-interactive error message.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.ParameterName = value; secretPrompt.ParameterName(value);public static SecretPrompt Required(SecretPrompt secretPrompt, bool value = true) #Sets SecretPrompt.Required: Whether an empty answer is refused.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
secretPrompt.Required = value; secretPrompt.Required(value);public static SecretPrompt Title(SecretPrompt secretPrompt, string value) #Sets Prompt<string>.Title: The question.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
secretPrompt.Title = value; secretPrompt.Title(value);public static SecretPrompt Validate(SecretPrompt secretPrompt, Func<string, string?>? value) #Sets SecretPrompt.Validator: A validator: returns an error message, or null.
Parameters
- secretPrompt ConsoleMonster.Interactive.SecretPrompt
- The instance.
- value System.Func<string, string?>?
- The callback.
Examples
// C# initializer or property // C# fluent
secretPrompt.Validator = value; secretPrompt.Validate(value);