Table of Contents

Class TigerCliCommandBuilder

Namespace
ItTiger.TigerCli.Commands
Assembly
ItTiger.TigerCli.dll
Configures metadata, providers, and help-only environment-variable registrations for a single command registration.
public sealed class TigerCliCommandBuilder
Inheritance
TigerCliCommandBuilder
Inherited Members

Methods

AddAsyncProvider(string, Func<TigerCliProviderContext, Task<IReadOnlyList<string>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level string provider. Prefer this over the sync AddProvider(string, Func<TigerCliProviderContext, IReadOnlyList<string>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?) for slow or I/O-backed providers; observe CancellationToken to make the work cooperatively cancellable, and use configure to customize the loading message.
public TigerCliCommandBuilder AddAsyncProvider(string key, Func<TigerCliProviderContext, Task<IReadOnlyList<string>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, Task<IReadOnlyList<string>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

AddAsyncProvider<TValue>(string, Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level named provider. Prefer this over the sync overload for slow or I/O-backed providers; observe CancellationToken to make the work cooperatively cancellable, and use configure to customize the loading message.
public TigerCliCommandBuilder AddAsyncProvider<TValue>(string key, Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TValue

AddAsyncProvider<TSettings, TValue>(string, Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level named provider that can read partially bound settings. Prefer this over the sync overload for slow or I/O-backed providers; observe CancellationToken to make the work cooperatively cancellable, and use configure to customize the loading message.
public TigerCliCommandBuilder AddAsyncProvider<TSettings, TValue>(string key, Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null) where TSettings : TigerCliSettings

Parameters

key string
provider Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TSettings
TValue

AddEnvironmentVariable(string, string)

Adds command-local help metadata for an environment variable recognized by the command. TigerCli displays it in this command's --help-env output; it does not read, parse, or apply the variable.
public TigerCliCommandBuilder AddEnvironmentVariable(string name, string description)

Parameters

name string
The environment variable name.
description string
The help description. TigerCli markup is supported.

Returns

TigerCliCommandBuilder
This builder for chaining.

Exceptions

ArgumentException
name or description is null, empty, or whitespace, or name contains whitespace.
InvalidOperationException
name duplicates another variable on this command.

AddProvider(string, Func<TigerCliProviderContext, IReadOnlyList<string>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers a sync command-level string provider; each returned string is used as both value and label. Prefer the async overloads for slow or I/O-backed providers.
public TigerCliCommandBuilder AddProvider(string key, Func<TigerCliProviderContext, IReadOnlyList<string>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, IReadOnlyList<string>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AddProvider(string, Func<TigerCliProviderContext, Task<IReadOnlyList<string>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level string provider; each returned string is used as both value and label. Equivalent to AddAsyncProvider(string, Func<TigerCliProviderContext, Task<IReadOnlyList<string>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?), which is the preferred spelling for new code.
public TigerCliCommandBuilder AddProvider(string key, Func<TigerCliProviderContext, Task<IReadOnlyList<string>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, Task<IReadOnlyList<string>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AddProvider<TValue>(string, Func<TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers a sync command-level named provider returning key/label pairs (OptionItem<TKey>). Prefer the async overloads for slow or I/O-backed providers.
public TigerCliCommandBuilder AddProvider<TValue>(string key, Func<TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TValue

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AddProvider<TValue>(string, Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level named provider returning key/label pairs (OptionItem<TKey>). Equivalent to the AddAsyncProvider spelling, which is preferred for new code.
public TigerCliCommandBuilder AddProvider<TValue>(string key, Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null)

Parameters

key string
provider Func<TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TValue

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AddProvider<TSettings, TValue>(string, Func<TSettings, TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers a sync command-level named provider that additionally receives the partially bound settings instance. Prefer the async overloads for slow or I/O-backed providers.
public TigerCliCommandBuilder AddProvider<TSettings, TValue>(string key, Func<TSettings, TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null) where TSettings : TigerCliSettings

Parameters

key string
provider Func<TSettings, TigerCliProviderContext, IReadOnlyList<OptionItem<TValue>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TSettings
TValue

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AddProvider<TSettings, TValue>(string, Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>, IEnumerable<string>?, Action<TigerCliProviderOptions>?)

Registers an async command-level named provider that additionally receives the partially bound settings instance, letting the choices depend on values supplied earlier in the run. Equivalent to the AddAsyncProvider spelling, which is preferred for new code.
public TigerCliCommandBuilder AddProvider<TSettings, TValue>(string key, Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>> provider, IEnumerable<string>? dependsOn = null, Action<TigerCliProviderOptions>? configure = null) where TSettings : TigerCliSettings

Parameters

key string
provider Func<TSettings, TigerCliProviderContext, Task<IReadOnlyList<OptionItem<TValue>>>>
dependsOn IEnumerable<string>
configure Action<TigerCliProviderOptions>

Returns

TigerCliCommandBuilder

Type Parameters

TSettings
TValue

Exceptions

ArgumentException
key is null, empty, or whitespace.
ArgumentNullException
provider is null.

AppendTitle(string)

Appends command-specific text to the app title for this command, using {AppTitle} - {titleAppend}. Cannot be combined with SetTitle(string).
public TigerCliCommandBuilder AppendTitle(string titleAppend)

Parameters

titleAppend string

Returns

TigerCliCommandBuilder

Exceptions

ArgumentException
titleAppend is null, empty, or whitespace.
InvalidOperationException
SetTitle(string) was already configured.

AsEdit<TSettings>(Func<TSettings, TigerCliEditLoad<TSettings>>)

public TigerCliCommandBuilder AsEdit<TSettings>(Func<TSettings, TigerCliEditLoad<TSettings>> loader) where TSettings : TigerCliSettings

Parameters

loader Func<TSettings, TigerCliEditLoad<TSettings>>

Returns

TigerCliCommandBuilder

Type Parameters

TSettings

AsEdit<TSettings>(Func<TSettings, Task<TigerCliEditLoad<TSettings>>>)

Marks this command as an edit command. Before prompting, the framework invokes loader with the already-bound settings (selector arguments and command-line overrides applied). The loader returns Found(TSettings) with the existing object's values, or NotFound(). Existing values seed every property that was not supplied on the command line; command-line values always win. The command handler still owns saving the edited object.
public TigerCliCommandBuilder AsEdit<TSettings>(Func<TSettings, Task<TigerCliEditLoad<TSettings>>> loader) where TSettings : TigerCliSettings

Parameters

loader Func<TSettings, Task<TigerCliEditLoad<TSettings>>>

Returns

TigerCliCommandBuilder

Type Parameters

TSettings

CommandMenu(CommandMenuMode)

Sets this command's command-menu opinion. Combined with the app and group levels, a command is shown in the menu when the chain has at least one Enabled and no Disabled. Use Disabled to hide an otherwise-eligible command from the menu.
public TigerCliCommandBuilder CommandMenu(CommandMenuMode mode)

Parameters

mode CommandMenuMode

Returns

TigerCliCommandBuilder

SetPromptMode(TigerCliPromptMode)

Sets the prompt mode override for this command registration.
public TigerCliCommandBuilder SetPromptMode(TigerCliPromptMode mode)

Parameters

mode TigerCliPromptMode

Returns

TigerCliCommandBuilder

SetTitle(string)

Replaces the app title entirely while this command is active. Cannot be combined with AppendTitle(string).
public TigerCliCommandBuilder SetTitle(string titleSet)

Parameters

titleSet string

Returns

TigerCliCommandBuilder

Exceptions

ArgumentException
titleSet is null, empty, or whitespace.
InvalidOperationException
AppendTitle(string) was already configured.