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

Definition

Assembly XenoAtom.CommandLine.dll

Adds an option or argument with validation.

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

Type parameters

TCommand
Type of the command container.

Parameters

command
{TCommand}

The command to add the option or argument to.

prototype
String

The prototype of the option or argument.

description
String

The help description.

action
Action<String?>

The associated action.

validate
OptionValidator<T>

The optional validator.

envVar
String

The optional environment variable fallback (options only).

envVarDelimiter
Nullable<Char>

Optional delimiter used to split multiple fallback values.

hidden
Boolean

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

Returns

{TCommand}
The command container.