Method Parse
Parse(IEnumerable<String>)
Parse arguments list from platform provided list of args
Declaration
IImmutableList<ICommandlineArgument> Parse(IEnumerable<string> args)
Parameters
IImmutableList<ICommandlineArgument> Parse(IEnumerable<string> args)
System.Collections.Generic.IEnumerable<String> | args | Args list provided to Main() or via GetCommandLineArgs() |
Returns
System.Collections.Immutable.IImmutableList<ICommandlineArgument> | The list of parsed arguments in the order they appeared on the command line |
Remarks
This will parse the command line into the various components in the order they appeared
on the command line. The ordering is important as some application may depend on specific
ordering of the command line. For example git command lines usually take the form:
git (-o --option)? command (-o --option)*
Where each command has a different set of options it allows. Thus the first item must always
be a positional value. (or not, as git itself may have some options too). Thus, the actual
ordering of the results matters as the options that precede or follow a positional value may
act as modifiers for the values.
Another, related, benefit of returning the arguments in the order supplied is to allow
for applications that desire space delimited values of options. For example the input text
-optionWithValue optionvalue -optionwithoutvalue positional
will return four items in
the list. Only the application, which understands the semantics, can know that optionvalue
really is the value to associate with the preceding option -optionWithValue