ArgsReader class

Helps process command-line arguments.

public sealed class ArgsReader

Public Members

name description
ArgsReader(…) Creates a reader for the specified command-line arguments.
LongOptionIgnoreCase { get; set; } True if long options (e.g. --help) should ignore case. (Default false.)
LongOptionIgnoreKebabCase { get; set; } True if long options (e.g. --dry-run) should ignore “kebab case”, i.e. allow --dryrun. (Default false.)
NoOptionsAfterDoubleDash { get; set; } True if -- is ignored and all following arguments are not read as options. (Default false.)
ShortOptionIgnoreCase { get; set; } True if short options (e.g. -h) should ignore case. (Default false.)
ReadArgument() Reads the next non-option argument.
ReadArguments() Reads any remaining non-option arguments.
ReadFlag(…) Reads the specified flag, returning true if it is found.
ReadOption(…) Reads the value of the specified option, if any.
VerifyComplete() Confirms that all arguments were processed.

Remarks

To use this class, construct an ArgsReader with the command-line arguments from Main, read the supported options one at a time with ReadFlag and ReadOption, read any normal arguments with ReadArgument, and finally call VerifyComplete, which throws an ArgsReaderException if any unsupported options or arguments haven’t been read.

See Also