Closed shinokada closed 3 years ago
param
It requires a value. For example, --foobar VALUE
is correct, but --foobar
is wrong.
option
It accepts a value, but can be omitted. For example, --foobar=VALUE
and --foobar
are correct.
If you omit the value, the default value is the value specified by on
.
--foobar
(the value specified by on
)--foobar=VALUE
--no-foobar
(the value specified by no
)An option
is a param
whose value can be omitted, and an option
without a value can be regarded as a kind of flag
.
The option has init
and on
. If the default value is the value specified by on, then what is the init
for?
init:[@INIT-VALUE | =STRING | CODE] - Initial value
...
on:STRING - The positive value
no:STRING - The negative value
The init
is the value when no options are specified. That is, the value when none of -?
, +?
, --*
, --no-*
are specified. The "default value" is the default value when the option is specified (but without a value).
The term "default value" is ambiguous, so we use init
(initial value when no option is specified) and on
(the value when a command line option without a value is specified) instead.
What is the difference between param and option?
I can see that
option
hason
andno
:It seems like a mixture of flag and option. The option can be used as a flag and also you can add an argument.
Is this a correct interpretation?