The Parse-Arguments library uses a standard set of terminology for representing the tokens which might appear on a command line.

Figure 16-1. Sample command line.

$ sample-app -v --repeat -n=10 foo.txt -- bar.txt
application name

The application name appears first on the command line. Under Unix-like systems, the application name is passed to the program exactly as typed. In particular, it may be the name of a symlink or include one or more directory components.

command-line arguments

Everything appearing after the application name is a command-line argument.

regular argument

In Figure 16-1, foo.txt and bar.txt are regular arguments.


Options are also known as flags and switches. They control the behavior of the application, and may appear in one of two forms. Short options always appear after a single dash, but several of them may be grouped together (e.g. -tzvf in GNU tar). In Figure 16-1, -v and -n are both short options. Long options such as --repeat consist of entire words and are always preceded by two dashes.


Parameters modify the behavior of an option. In Figure 16-1, the 10 following -n is a parameter. Note that the equals sign may be surrounded by white space or omitted entirely where unambiguous.

option terminator

The double dash without an option name is called an option terminator. Any arguments appearing after the terminator are automatically regular arguments, even if they begin with a dash.