For the purposes of this module, arguments are divided into two types:
Positional arguments do not begin with a hyphen. When there are multiple positional arguments, the meaning of each one is inferred from their position relative to the other positional arguments.
Optional arguments begin
with a hyphen. In general each optional argument may
have two forms, a short form consisting of a hyphen
and a letter (e.g., “-h”
for help), and a long form consisting of two hyphens
and a full name (e.g., “--help”). Generally optional arguments are not
required, but your program can make them required if
you wish.
Some optional arguments may allow or require a value.
For example, let's suppose your script has an option
that specifies the name of a river, and that the
short form is “-r” and
the long form is “--river”. On the command line, the user can specify
the Nile in any of these four ways:
-r Nile -rNile --river Nile --river=Nile
Users may group multiple short-form options together.
For example, if a script named sss has
options “-a”, “-m”, “-p”,
and “-s”, these two examples
are valid and equivalent:
sss -a -m -p -s sss -spma
A short-form option that takes an argument may occur as part of such a group, but only if it is the last option in the group.
Contrary to Unix practice, optional arguments may occur
anywhere relative to the positional arguments. Also,
the names of long-form optional arguments may be
abbreviated if the abbreviation is unambiguous. For
example, if a script has two long-form options --pratt and --polonius, option
--pr will be accepted as an abbreviation
for --pratt; but --p would
not be acceptable because it is ambiguous.