Table of Contents

Class TigerCliSettings

Namespace
ItTiger.TigerCli.Commands
Assembly
ItTiger.TigerCli.dll
Base class for command settings. A settings class declares a command's CLI surface through properties decorated with TigerCliOptionAttribute and TigerCliArgumentAttribute; the framework creates the instance, binds command-line input onto the decorated properties, prompts for missing promptable values (mode permitting), runs framework validation and then Validate(), and finally passes the instance to the command handler's ExecuteAsync.
public abstract class TigerCliSettings
Inheritance
TigerCliSettings
Inherited Members

Properties

CancellationToken

The run's cancellation token, populated by the framework before validation and handler execution. It combines the token passed to TigerCliApp.RunAsync with TigerCli's process/system cancellation (Ctrl-C / SIGINT / SIGTERM / SIGQUIT) when TigerCli owns signal handling, so a handler observes both through one token in either interaction mode.
public CancellationToken CancellationToken { get; }

Property Value

CancellationToken

Remarks

Handlers should thread this into their own asynchronous work and pass it to activity calls explicitly — TigerTui.RunActivityAsync(spec, operation, ct: settings.CancellationToken) — which is what makes a non-interactive headless activity cancellable. A handler that catches cancellation may return its own exit code; a cancellation that escapes the handler while this token is cancelled is reported quietly and mapped through Cancelled rather than UnhandledException. The token is not cancelable when the host supplied no token and TigerCli does not own process cancellation. It is tied to the run: do not retain it, or anything registered on it, after ExecuteAsync returns.

Culture

The resolved active run culture, populated by the framework before validation and handler execution. Defaults to en-US. The text-lookup helpers on this class resolve resources against this culture without mutating CurrentUICulture.
public CultureInfo Culture { get; }

Property Value

CultureInfo

InteractionMode

The effective interaction mode, resolved by the framework before validation and handler execution. Handlers read this to decide whether interactive UI is available.
public TigerCliInteractionMode InteractionMode { get; }

Property Value

TigerCliInteractionMode

Methods

E(string, params object?[])

Source-text format lookup for TigerCli markup: resolves the format string via T(string), converts each argument invariantly, escapes it with CliMarkupParser.Escape, then formats invariantly.
public string E(string fallbackFormat, params object?[] args)

Parameters

fallbackFormat string
args object[]

Returns

string

EscapedFormatTextByKey(string, string, params object?[])

Explicit-key format lookup for TigerCli markup via TextByKey(string, string): converts each argument invariantly, escapes it with CliMarkupParser.Escape, then formats invariantly.
public string EscapedFormatTextByKey(string resourceKey, string fallbackFormat, params object?[] args)

Parameters

resourceKey string
fallbackFormat string
args object[]

Returns

string

F(string, params object?[])

Source-text format lookup: resolves the format string via T(string), then formats with InvariantCulture. Arguments are not markup-escaped; use E(string, params object?[]) when arguments may contain markup-significant characters.
public string F(string fallbackFormat, params object?[] args)

Parameters

fallbackFormat string
args object[]

Returns

string

FormatTextByKey(string, string, params object?[])

Explicit-key format lookup via TextByKey(string, string), then formats with InvariantCulture. Arguments are not markup-escaped; use EscapedFormatTextByKey(string, string, params object?[]) when arguments may contain markup-significant characters.
public string FormatTextByKey(string resourceKey, string fallbackFormat, params object?[] args)

Parameters

resourceKey string
fallbackFormat string
args object[]

Returns

string

T(string)

Source-text lookup: uses text as both the resource key and the fallback, resolves against the app resources (registered via UseAppResources) using Culture, and returns text unchanged when resources, key, or value are missing.
public string T(string text)

Parameters

text string

Returns

string

TextByKey(string, string)

Explicit-key lookup from the registered app ResourceManager using Culture; returns fallback when resources, key, or value are missing.
public string TextByKey(string resourceKey, string fallback)

Parameters

resourceKey string
fallback string

Returns

string

Validate()

User-defined validation hook, invoked by the framework after binding, prompting, and framework validation succeed and before the handler executes. Return Error(string) to fail the run: the message is rendered as literal text (markup-escaped) in the framework error line and the run ends with the ValidationError exit mapping. The default implementation returns Success(). Use the text-lookup helpers (such as T(string)) to produce localized messages.
public virtual TigerCliValidationResult Validate()

Returns

TigerCliValidationResult