Class TigerCliOptionAttribute
Binds a settings property to a named command-line option (e.g.
-c / --connection).
Apply to a writable property on a TigerCliSettings-derived type; the constructor
template defines the option's aliases.[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class TigerCliOptionAttribute : Attribute
- Inheritance
-
TigerCliOptionAttribute
- Inherited Members
Remarks
In semi-interactive mode, a missing promptable scalar option can be resolved before required-value
validation runs. Built-in scalar prompts support
string, int / int?, enum /
nullable enum, bool?, and provider-backed select values. In non-interactive mode no prompt
is shown; missing required options fail validation instead of blocking for input.Constructors
TigerCliOptionAttribute(string)
Defines a CLI option with one or more aliases separated by
|, e.g.
"-c|--connection". Short aliases (-x) must be 1–8 letters; long aliases
(--name) must start with a letter followed by letters, digits, _ or -.public TigerCliOptionAttribute(string template)
Parameters
templatestring- The alias template; at least one alias, each starting with
-or--.
Exceptions
- ArgumentException
- The template defines no alias or contains an invalid alias.
Properties
Aliases
The option's aliases as parsed from the constructor template (e.g.
-c and
--connection from "-c|--connection").public string[] Aliases { get; }
Property Value
- string[]
AllowCommandLineValue
Controls whether this option may be supplied through argv. Set false
for prompt-only secrets such as passwords.
public bool AllowCommandLineValue { get; set; }
Property Value
AutoSelectSingleChoice
When true, a provider-backed prompt may skip the select UI and bind the only selectable
outcome. The default is false so prompts continue to ask for confirmation unless opted in.
public bool AutoSelectSingleChoice { get; set; }
Property Value
DependsOnOption
Alias or property name of an option that should be resolved before this option.
This is an ordering dependency only; it does not imply requiredness or prompting.
public string? DependsOnOption { get; set; }
Property Value
DependsOnOptions
Aliases or property names of options that should be resolved before this option.
These are ordering dependencies only; they do not imply requiredness or prompting.
public string[]? DependsOnOptions { get; set; }
Property Value
- string[]
Description
Fallback help/prompt text for this option. Replaced by
DescriptionResourceKey when that key resolves.
public string? Description { get; set; }
Property Value
DescriptionResourceKey
Optional resource key resolved through the app-owned ResourceManager
registered via
TigerCliAppBuilder.UseAppResources(...) against the active
run culture. When the key resolves to a non-empty string it replaces
Description in help and prompt text. Missing keys silently fall
back to Description; the raw key is never surfaced.public string? DescriptionResourceKey { get; set; }
Property Value
EditProvider
Optional named provider key used only in edit mode. When set (non-empty),
edit-command resolution uses this provider in place of Provider for
this option; in add/normal commands it is ignored and Provider is used.
This is the option-level symmetry of the argument-level edit provider, for settings
types shared by an add and an edit command where the edit command needs a
provider-backed selector over existing values. Empty or whitespace is treated as not
configured.
public string? EditProvider { get; set; }
Property Value
Editable
Controls whether this option participates in edit-command behavior. When
false, the option is not prompted as an editable field in edit mode and is
not provider-validated. Options are editable by default. Note that this
setting is not fully inert outside edit mode: a non-editable option is
currently skipped by provider validation in all command modes.
public bool Editable { get; set; }
Property Value
ForbiddenValues
Values that are not accepted for this option.
Primarily used with enum options to exclude sentinel values (e.g.
Mode.Unspecified)
from both validation and help output.public object[]? ForbiddenValues { get; set; }
Property Value
- object[]
MaxLength
Maximum string length for the supplied value. Unset is
-1 (no maximum). Applied as
live validation while prompting and as final framework validation for values supplied on the
command line or accepted from a prompt.public int MaxLength { get; set; }
Property Value
MaxValue
Maximum integer value. Unset sentinel is MaxValue. Mutually exclusive with
MaxValueProvider. Applied both as live validation while prompting and as final
framework validation of supplied values. Bound failures are validation errors
(ValidationError).
public int MaxValue { get; set; }
Property Value
MaxValueProvider
Optional named provider key supplying the integer maximum dynamically. The provider must
resolve to exactly one int-compatible key. Used only when MaxValue is unset,
during integer prompts and final integer-bound validation. Missing providers, non-integer
values, multiple values, and
MaxValueProvider / MaxValue conflicts are
validation errors.public string? MaxValueProvider { get; set; }
Property Value
MinLength
Minimum string length for the supplied value. Unset is
-1 (no minimum). Applied as
live validation while prompting and as final framework validation for values supplied on the
command line or accepted from a prompt.public int MinLength { get; set; }
Property Value
MinValue
Minimum integer value. Unset sentinel is MinValue. Mutually exclusive with
MinValueProvider. Applied both as live validation while prompting and as final
framework validation of supplied values. Bound failures are validation errors
(ValidationError).
public int MinValue { get; set; }
Property Value
MinValueProvider
Optional named provider key supplying the integer minimum dynamically. The provider must
resolve to exactly one int-compatible key. Used only when MinValue is unset,
during integer prompts and final integer-bound validation. Missing providers, non-integer
values, multiple values, and
MinValueProvider / MinValue conflicts are
validation errors.public string? MinValueProvider { get; set; }
Property Value
PromptWhenOption
Alias of the option that allows prompting for this option when it has
PromptWhenValue.
public string? PromptWhenOption { get; set; }
Property Value
PromptWhenValue
Expected value for PromptWhenOption. When set and the
condition is false, TigerCli will not prompt for this option.
public string? PromptWhenValue { get; set; }
Property Value
PromptWhenValueIn
Expected values for PromptWhenOption. The condition matches
when the referenced option value equals any configured value.
public string[]? PromptWhenValueIn { get; set; }
Property Value
- string[]
PromptWhenValueNotIn
Excluded values for PromptWhenOption. The condition matches
when the referenced option has a value and it equals none of the configured values.
public string[]? PromptWhenValueNotIn { get; set; }
Property Value
- string[]
Promptable
Controls whether TigerCli may prompt for this option when it is missing.
Unspecified uses the effective command/app prompt mode.
public TigerCliPromptable Promptable { get; set; }
Property Value
Provider
Optional named provider key. A provider serves two purposes: a missing value can be prompted
as a select over the provider's choices in semi-interactive mode, and a supplied command-line
value is validated against those choices unless ValidateAgainstProvider is
false. This is metadata and is not shown as a display label.public string? Provider { get; set; }
Property Value
Required
When true, the option must be provided by argv or resolved by an allowed prompt before the
handler runs. Default initializer values are not treated as valid input.
public bool Required { get; set; }
Property Value
RequiredWhenOption
Alias of the option that makes this option required when it has
RequiredWhenValue.
public string? RequiredWhenOption { get; set; }
Property Value
RequiredWhenValue
Expected value for RequiredWhenOption. Enum names, bool
values, and strings are compared against the referenced option value.
public string? RequiredWhenValue { get; set; }
Property Value
RequiredWhenValueIn
Expected values for RequiredWhenOption. The condition matches
when the referenced option value equals any configured value.
public string[]? RequiredWhenValueIn { get; set; }
Property Value
- string[]
RequiredWhenValueNotIn
Excluded values for RequiredWhenOption. The condition matches
when the referenced option has a value and it equals none of the configured values.
public string[]? RequiredWhenValueNotIn { get; set; }
Property Value
- string[]
Secret
When true, automatic text prompting masks the rendered value.
public bool Secret { get; set; }
Property Value
ValidateAgainstProvider
Controls whether the effective value of this option is validated against its
provider's choices. The default is
true, so a provider-backed editable
option is validated whenever a provider is configured — in all command modes,
interactive and non-interactive. A supplied value that is not an available
choice fails with a validation error; a matching value is re-bound to the
canonical provider key. Validation runs after required-value validation and reports
ValidationError on mismatch. Set to false when the provider is
suggestions-only and custom values are acceptable. Has no effect when no
provider is configured or when the option is not editable.public bool ValidateAgainstProvider { get; set; }
Property Value
ValueMatching
Controls how a supplied value is matched against this option's provider choices during
provider validation and multi-select resolution. The default
(Default) matches string keys and labels
case-insensitively. Use Exact for case-sensitive
matching, or FileSystemPath for path-like provider
keys. Regardless of preset, the bound value is the provider's canonical key.
public TigerCliValueMatchPreset ValueMatching { get; set; }
Property Value
ValueName
Optional placeholder name shown in help output (e.g. "connection-string", "sql").
If not specified, a fallback is derived automatically from the property type.
public string? ValueName { get; set; }