Class CommandArgument
- Namespace
- McMaster.Extensions.CommandLineUtils
- Assembly
- McMaster.Extensions.CommandLineUtils.dll
Represents one or many positional command line arguments. Arguments are parsed in the order in which Arguments lists them.
public class CommandArgument
- Inheritance
-
objectCommandArgument
- Derived
- Extension Methods
Properties
DefaultValue
The default value of the argument.
public string? DefaultValue { get; set; }
Property Value
Description
A description of the argument.
public string? Description { get; set; }
Property Value
HasValue
True when Values is not empty or when a DefaultValue is given.
public bool HasValue { get; }
Property Value
MultipleValues
Allow multiple values.
public bool MultipleValues { get; set; }
Property Value
Name
The name of the argument.
public string? Name { get; set; }
Property Value
ShowInHelpText
Determines if the argument appears in the generated help-text.
public bool ShowInHelpText { get; set; }
Property Value
Validators
A collection of validators that execute before invoking OnExecute(Func<int>). When validation fails, ValidationErrorHandler is invoked.
public ICollection<IArgumentValidator> Validators { get; }
Property Value
Value
The first value from Values, if any, or DefaultValue.
public string? Value { get; }
Property Value
Values
All values specified, if any.
public IReadOnlyList<string?> Values { get; }
Property Value
Methods
Reset()
Clear any parsed values from this argument.
public virtual void Reset()
TryParse(string?)
Try to add a value to this argument.
public bool TryParse(string? value)
Parameters
valuestringThe argument value to be added.
Returns
- bool
True if the value was accepted, false if the value cannot be added.