-
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:
-
-a
selects optiona
as current. -
1
is added to the values of thea
option. -
-b
selects optionb
as current. -
-c
selects optionc
as current. - The contents of the file
x
are read. Assume thatx
consists of the line3 -a
.-
3
is added to the values of thec
option. -
-a
selects optiona
as current.
-
-
2
is added to the values of thea
option.
The end result is that there are three options present:
-
a
has values1
,2
. -
b
is present but has no values. -
c
has value3
. -
d
is 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.