Namespace Juhta.Net.Console
Classes
CommandLineArgument
Defines an abstract base class for command line arguments.
CommandLineArgumentException
This exception will be thrown when an invalid argument is encountered in command line parsing.
CommandLineParser
Defines a class for parsing command line arguments. The following types of command line arguments are supported:
Argument type | Description |
---|---|
Named arguments | Represents a named command line argument |
Option arguments | Represents a command line option |
Plain arguments | Represents any raw command line argument |
A named argument consists of two raw arguments. The first argument determines an argument name and the
second argument an actual argument value. Argument names must be prefixed by an argument name prefix. For
example, -workingFolder C:\Temp
is a valid named argument. Character '-' is the default named argument
prefix.
An option argument consists of an option prefix, option name, option name-value separator and an actual
option value. For example, /BufferSize:12345
is a valid option argument. Characters '/' and ':' are the
default option prefix and option name-value separator, respectively. If a value part is missing from an option
argument, it’s assumed to be a boolean option with the default value of true. Thus, the option arguments
/SaveLog
and /SaveLog:true
are equivalent.
A plain argument is any raw argument that doesn’t fall into the two categories above. In other words, all raw arguments that are not prefixed either by an argument name prefix or an option prefix, are treated as plain arguments.
CommandLineParserException
This exception will be thrown when a command line parser encounters an error not related to command line arguments.
NamedArgument
Defines a class that represents a named argument. At the command line level, named arguments consist of two separate raw arguments. The first argument specifies the name for the argument and the second argument the actual argument value. The first argument must begin with a named argument prefix.
NameValueArgument
Defines an abstract base class for command line arguments that consist of name and value pairs.
OptionArgument
Defines a class that represents an option argument. At the command line level, option arguments consist of a prefix, name and an optional value, which is separated by a name-value separator from the name part. If the value part is missing, the option argument is assumed to be a boolean option with a 'true' value.
PlainArgument
Defines a class that represents a plain argument. At the command line level, plain arguments are handled as individual arguments without any parsing. An argument is assumed to be a plain argument if it doesn’t begin with a reserved prefix and it’s not a successor of an argument name argument.