Skip to content
ConsoleMonster
Class

SecretField

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Base
Field
Modifiers
sealed

A secret: masked in the form, never shown on the review page, never stored, a placeholder in the command.

Inheritance

Usage

Explore 50 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.

Accepted by parameters 24

Constructors

public SecretField(string key, string? label = null) #

Creates a secret field.

Parameters

key string required
The key.
label string? = null optional
The label.

Methods

public override string Display(object? value, PromptLabels labels) #

The value as shown in the form and on the review page.

Parameters

value object? required
The value.
labels ConsoleMonster.Interactive.PromptLabels required
The labels.

Returns

string The text.

Properties

public override FieldKind Kind { get; } #

The kind.

public string CommandPlaceholder { get; set; } #

What stands in for the secret in the equivalent command (PowerShell: (Read-Host -AsSecureString)).

public int MinLength { get; set; } #

The fewest characters.

Extension Methods

public static SecretField CommandPlaceholder(SecretField secretField, string value) #

Sets SecretField.CommandPlaceholder: What stands in for the secret in the equivalent command (PowerShell: (Read-Host -AsSecureString)).

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value string required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property              // C# fluent
secretField.CommandPlaceholder = value;    secretField.CommandPlaceholder(value);
public static SecretField Default(SecretField secretField, object? value) #

Sets Field.Default: The declared default: the starting value until a value is set, and values equal to it are left out of the equivalent command.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value object? required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Default = value;     secretField.Default(value);
DependsOn 2 overloads
public static SecretField DependsOn(SecretField secretField, string item) #

Adds an item to Field.DependsOn: Fields whose change resets this field (and reloads its options).

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
item string required
The item.

Returns

SecretField The same instance.
public static SecretField DependsOn(SecretField secretField, IEnumerable<string> items) #

Adds items to Field.DependsOn: Fields whose change resets this field (and reloads its options).

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

SecretField The same instance.
public static SecretField Help(SecretField secretField, string? value) #

Sets Field.Help: Help shown while the field has focus.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value string? required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Help = value;        secretField.Help(value);
public static SecretField Label(SecretField secretField, string value) #

Sets Field.Label: The label.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value string required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Label = value;       secretField.Label(value);
public static SecretField MinLength(SecretField secretField, int value) #

Sets SecretField.MinLength: The fewest characters.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value int required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property     // C# fluent
secretField.MinLength = value;    secretField.MinLength(value);
public static SecretField ParameterName(SecretField secretField, string? value) #

Sets Field.ParameterName: The command-line parameter this field supplies (Domain, -Domain, --domain); null leaves the field out of the equivalent command.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value string? required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property         // C# fluent
secretField.ParameterName = value;    secretField.ParameterName(value);
public static SecretField Remember(SecretField secretField, bool value = true) #

Sets Field.Remember: Whether the value is kept in presets and remembered choices (never for secrets).

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value bool = true optional
The value; true when omitted.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Remember = value;    secretField.Remember(value);
public static SecretField Required(SecretField secretField, bool value = true) #

Sets Field.Required: Whether an empty value is refused.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value bool = true optional
The value; true when omitted.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Required = value;    secretField.Required(value);
public static SecretField ShowWhen(SecretField secretField, Func<FormValues, bool>? value) #

Sets Field.VisibleWhen: Shows the field only while this returns true.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value System.Func<ConsoleMonster.Interactive.FormValues, bool>? required
The callback.

Returns

SecretField The same instance.

Examples

// C# initializer or property       // C# fluent
secretField.VisibleWhen = value;    secretField.ShowWhen(value);
public static SecretField Validate(SecretField secretField, Func<object?, FormValues, string?>? value) #

Sets Field.Validator: A validator: returns an error message, or null when the value is fine.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value System.Func<object?, ConsoleMonster.Interactive.FormValues, string?>? required
The callback.

Returns

SecretField The same instance.

Examples

// C# initializer or property     // C# fluent
secretField.Validator = value;    secretField.Validate(value);
public static SecretField Value(SecretField secretField, object? value) #

Sets Field.Value: The current value.

Parameters

secretField ConsoleMonster.Interactive.SecretField required
The instance.
value object? required
The value.

Returns

SecretField The same instance.

Examples

// C# initializer or property    // C# fluent
secretField.Value = value;       secretField.Value(value);