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

Definition

Assembly XenoAtom.CommandLine.dll

Adds an option which expects a specified type for its value with an environment variable fallback.

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

Type parameters

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

Parameters

command
{TCommand}

The command to add the option to.

prototype
String

The prototype of the option. E.g "v|version".

description
String

The help description for this option.

action
Action<T>

The associated action.

envVar
String

The environment variable used as a fallback value.

envVarDelimiter
Nullable<Char>

Optional delimiter used to split multiple fallback values.

Returns

{TCommand}
The command container.