Table of Contents

Class TigerCliGlobalOptionBuilder

Namespace
ItTiger.TigerCli.Commands
Assembly
ItTiger.TigerCli.dll
Registers simple app-wide global options supplied by app contributions. Options use one constrained shape: an optional string value with one canonical long option name.
public sealed class TigerCliGlobalOptionBuilder
Inheritance
TigerCliGlobalOptionBuilder
Inherited Members

Methods

AddOptionalString(string, string, string, Func<TigerCliGlobalOptionContext, string?, TigerCliValidationResult>)

Adds an optional, CLI-only string global option. The option is app-wide in meaning but follows TigerCli's command-line grammar, appearing after the command path and positional arguments with other options. It appears in root and command help, is never prompted, and invokes apply once per command run with null when absent. Return a validation error to stop the run before command binding and execution.
public TigerCliGlobalOptionBuilder AddOptionalString(string name, string valueName, string description, Func<TigerCliGlobalOptionContext, string?, TigerCliValidationResult> apply)

Parameters

name string
The canonical long name, beginning with --.
valueName string
The value placeholder displayed in help, such as path.
description string
The help description. TigerCli markup is supported.
apply Func<TigerCliGlobalOptionContext, string, TigerCliValidationResult>
Applies the parsed value to contribution-owned state and optionally validates it. The value is null when the option was not supplied.

Returns

TigerCliGlobalOptionBuilder
This builder for chaining.

Exceptions

ArgumentException
valueName or description is null, empty, or whitespace.
ArgumentNullException
apply is null.
InvalidOperationException
name is not a canonical long name, contains whitespace, is reserved by TigerCli, or duplicates another contributed global option.

AddOptionalString(string, string, string, Func<TigerCliGlobalOptionContext, string?, TigerCliValidationResult>, string?)

Adds an optional, CLI-only string global option with a localizable help description. The option follows TigerCli's command-line grammar, appears in root and command help, is never prompted, and invokes apply once per command run with null when absent. Return a validation error to stop the run before command binding and execution.
public TigerCliGlobalOptionBuilder AddOptionalString(string name, string valueName, string description, Func<TigerCliGlobalOptionContext, string?, TigerCliValidationResult> apply, string? descriptionResourceKey = null)

Parameters

name string
The canonical long name, beginning with --.
valueName string
The literal value placeholder displayed in help, such as path.
description string
Fallback help description used when the resource key is absent or does not resolve. TigerCli markup is supported.
apply Func<TigerCliGlobalOptionContext, string, TigerCliValidationResult>
Applies the parsed value to contribution-owned state and optionally validates it. The value is null when the option was not supplied.
descriptionResourceKey string
Optional resource key resolved through the app ResourceManager registered via TigerCliAppBuilder.UseAppResources(...) against the active run culture. Missing or empty resource values silently fall back to description.

Returns

TigerCliGlobalOptionBuilder
This builder for chaining.

Exceptions

ArgumentException
valueName or description is null, empty, or whitespace.
ArgumentNullException
apply is null.
InvalidOperationException
name is not a canonical long name, contains whitespace, is reserved by TigerCli, or duplicates another contributed global option.