Provides methods to parse command line arguments.
More...
|
| Parser () |
| Initializes a new instance of the CommandLine.Parser class. More...
|
|
| Parser (Action< ParserSettings > configuration) |
| Initializes a new instance of the Parser class, configurable with ParserSettings using a delegate. More...
|
|
ParserResult< T > | ParseArguments< T > (string[] args) |
| Parses a string array of command line arguments constructing values in an instance of type T . Grammar rules are defined decorating public properties with appropriate attributes. More...
|
|
ParserResult< T > | ParseArguments< T > (Func< T > factory, string[] args) |
| Parses a string array of command line arguments constructing values in an instance of type T . Grammar rules are defined decorating public properties with appropriate attributes. More...
|
|
ParserResult< object > | ParseArguments (string[] args, params Type[] types) |
| Parses a string array of command line arguments for verb commands scenario, constructing the proper instance from the array of types supplied by types . Grammar rules are defined decorating public properties with appropriate attributes. The CommandLine.VerbAttribute must be applied to types in the array. More...
|
|
void | Dispose () |
| Frees resources owned by the instance. More...
|
|
Provides methods to parse command line arguments.
CommandLine.Parser.Parser |
( |
| ) |
|
|
inline |
Initializes a new instance of the Parser class, configurable with ParserSettings using a delegate.
- Parameters
-
configuration | The Action<ParserSettings> delegate used to configure aspects and behaviors of the parser. |
void CommandLine.Parser.Dispose |
( |
| ) |
|
|
inline |
Frees resources owned by the instance.
ParserResult<object> CommandLine.Parser.ParseArguments |
( |
string[] |
args, |
|
|
params Type[] |
types |
|
) |
| |
|
inline |
Parses a string array of command line arguments for verb commands scenario, constructing the proper instance from the array of types supplied by types . Grammar rules are defined decorating public properties with appropriate attributes. The CommandLine.VerbAttribute must be applied to types in the array.
- Parameters
-
args | A System.String array of command line arguments, normally supplied by application entry point. |
types | A System.Type array used to supply verb alternatives. |
- Returns
- A CommandLine.ParserResult{T} containing the appropriate instance with parsed values as a System.Object and a sequence of CommandLine.Error.
- Exceptions
-
System.ArgumentNullException | Thrown if one or more arguments are null. |
System.ArgumentOutOfRangeException | Thrown if types array is empty. |
All types must expose a parameterless constructor. It's stronly recommended to use a generic overload.
Parses a string array of command line arguments constructing values in an instance of type T . Grammar rules are defined decorating public properties with appropriate attributes.
- Template Parameters
-
T | Type of the target instance built with parsed value. |
- Parameters
-
args | A System.String array of command line arguments, normally supplied by application entry point. |
- Returns
- A CommandLine.ParserResult{T} containing an instance of type T with parsed values and a sequence of CommandLine.Error.
- Exceptions
-
System.ArgumentNullException | Thrown if one or more arguments are null. |
Parses a string array of command line arguments constructing values in an instance of type T . Grammar rules are defined decorating public properties with appropriate attributes.
- Template Parameters
-
T | Type of the target instance built with parsed value. |
- Parameters
-
factory | A System.Func{T} delegate used to intitalize the target instance. |
args | A System.String array of command line arguments, normally supplied by application entry point. |
- Returns
- A CommandLine.ParserResult{T} containing an instance of type T with parsed values and a sequence of CommandLine.Error.
- Exceptions
-
System.ArgumentNullException | Thrown if one or more arguments are null. |
Parser CommandLine.Parser.Default |
|
staticget |
Gets the singleton instance created with basic defaults.
The documentation for this class was generated from the following file:
- src/CommandLine/Parser.cs