-
Notifications
You must be signed in to change notification settings - Fork 2
Command line parsing rules
These are the command line parsing rules used by parser:
A command line parameter that begins with a hyphen (U+002D) selects an option as "current". Command line options are case-sensitive.
A command line parameter that begins with an at-sign (U+0040) specifies that the contents of the file whose name follows the at-sign (no space) should be read and treated as additional command line parameters. The contents of the file are parsed the same way as CommandLineToArgvW. This operation is recursive: If the file contains command line arguments that also begin with an at-sign, those files are also read and expanded.
A command line parameter that does not begin with any of the special characters above is appended to the values associated with the "current" command line option. If there is no "current" command line option, then an error is raised.
An error is raised if a command line option is invalid or does not meet the minimum or maximum requirements.
For example, the command line
-a 1 -b -c @x 2
is parsed as follows:
-
-aselects optionaas current. -
1is added to the values of theaoption. -
-bselects optionbas current. -
-cselects optioncas current. - The contents of the file
xare read. Assume thatxconsists of the line3 -a.-
3is added to the values of thecoption. -
-aselects optionaas current.
-
-
2is added to the values of theaoption.
The end result is that there are three options present:
-
ahas values1,2. -
bis present but has no values. -
chas value3. -
dis not present.
Note that there is a distinction between a command line option that was never provided at all and a command line option that was provided with no values.