-
Notifications
You must be signed in to change notification settings - Fork 0
Parameter naming
A feature common to command-line applications is to provide both longer (more descriptive) parameter names, as well as shorter one-character aliases for commonly-used parameters.
The convention is that long parameter names are prefixed with two dashes, such as --my-long-param
and that short names are prefixed with a single dash, such as -l
.
The command-line reader/parser supports both of those syntaxes.
When registering parameters, at least one short name or at least one long name must be provided. Beyond this requirement, all further names are optional. Typically, every parameter should have a long name. Parameters which are in common use also have a short name so that they are faster to type.
It is possible to specify multiple long names/short names for the same parameter. Applications do not routinely provide multiple names/aliases for the same parameter, however this functionality is available in order to deal with backwards-compatibility.
Imagine a scenario in which you wish to rename a parameter (perhaps the old name is misleading) but you wish to continue supporting the parameter under the old name for a few application releases.