Table of Contents

Class TigerCliArgumentAttribute

Namespace
ItTiger.TigerCli.Commands
Assembly
ItTiger.TigerCli.dll
Binds a settings property to a positional command-line argument. Arguments are matched by position (Index) after the command path; they carry no alias on the command line. Apply to a writable property on a TigerCliSettings-derived type.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class TigerCliArgumentAttribute : Attribute
Inheritance
TigerCliArgumentAttribute
Inherited Members

Remarks

Positional arguments are required. In semi-interactive mode, a missing promptable argument can be resolved before missing-argument validation runs; in non-interactive mode no prompt is shown and the missing argument fails validation. Built-in scalar prompts support string, int / int?, enum / nullable enum, bool?, and provider-backed select values.

Constructors

TigerCliArgumentAttribute(int)

Declares a positional argument at the given zero-based index.
public TigerCliArgumentAttribute(int index)

Parameters

index int
The zero-based position of the argument; must be non-negative.

Exceptions

ArgumentOutOfRangeException
index is negative.

Properties

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

bool

Description

Fallback help/prompt text for this argument. Replaced by DescriptionResourceKey when that key resolves.
public string? Description { get; set; }

Property Value

string

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

string

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 argument; in add/normal commands it is ignored and Provider is used. This lets a settings type shared by an add and an edit command keep a typed value in add mode (no Provider) while offering a provider-backed selector over existing values in edit mode (e.g. a positional name that is a new name when adding but selects an existing record when editing). Empty or whitespace is treated as not configured.
public string? EditProvider { get; set; }

Property Value

string

Editable

Controls whether this argument participates in edit-command behavior. When false, the argument is not prompted as an editable field in edit mode and is not provider-validated as an editable field there — selector arguments defer to the edit loader instead. Arguments are not editable by default because positional arguments are usually selectors that identify the object being edited. This setting only affects edit mode; in normal commands provider validation is controlled by Provider and ValidateAgainstProvider alone.
public bool Editable { get; set; }

Property Value

bool

Index

The zero-based positional index of this argument within the command's argument list. Set through the constructor; must be non-negative.
public int Index { get; }

Property Value

int

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

int

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

int

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

string

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

int

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

int

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

string

Name

Optional display name used in help and prompt text. When not set, a kebab-case form of the property name is used.
public string? Name { get; set; }

Property Value

string

Promptable

Controls whether and when TigerCli may prompt for this argument when it is missing. When not assigned, the effective command/app prompt mode decides, in normal prompt order.
public TigerCliPromptable Promptable { get; set; }

Property Value

TigerCliPromptable

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. Implicit name-matched providers may help prompting but do not make positional argument values provider-authoritative for validation. This is metadata and is not shown as a display label.
public string? Provider { get; set; }

Property Value

string

ValidateAgainstProvider

Controls whether the effective value of this argument is validated against its provider's choices. The default is true: in normal commands an argument with an explicit Provider is validated (a supplied value that is not an available choice fails with a validation error, and a matching value is re-bound to the canonical provider key); in edit mode validation applies to editable arguments. Set to false when the provider is suggestions-only and custom values are acceptable. Validation runs after missing-argument validation and reports ValidationError on mismatch. Has no effect when no provider is configured.
public bool ValidateAgainstProvider { get; set; }

Property Value

bool

ValueMatching

Controls how a supplied value is matched against this argument's provider choices during provider validation. 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

TigerCliValueMatchPreset