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

Definition

Assembly XenoAtom.CommandLine.dll

Adds an option or argument that appends values to a list with optional validation.

public static TCommand Add<TCommand, T>(this TCommand command, string prototype, string? description, ICollection<T> list, 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.

list
ICollection<T>

The list that receives parsed values.

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.