Add<TCommand, T>(TCommand, String, String?, Action, OptionValidator?, Boolean, String?, Nullable) Method

Definition

Assembly XenoAtom.CommandLine.dll

Adds an option or argument with validation for typed values.

public static TCommand Add<TCommand, T>(this TCommand command, string prototype, string? description, Action<T> action, OptionValidator<T>? validate, bool hidden, string? envVar = null, char? envVarDelimiter = default(char? ))
    where TCommand : CommandContainer where T : ISpanParsable<T>

Type parameters

TCommand
Type of the command container.
T
The value type.

Parameters

command
{TCommand}

The command to add the node to.

prototype
String

The prototype of the option or argument.

description
String

The help description.

action
Action<T>

The associated action.

validate
OptionValidator<T>

The optional validator.

hidden
Boolean

A boolean indicating if this option or argument is hidden from help.

envVar
String

The optional environment variable fallback (options only).

envVarDelimiter
Nullable<Char>

Optional delimiter used to split multiple fallback values.

Returns

{TCommand}
The command container.