Did you know ... | Search Documentation: |
Predicate argv_options/3 |
When guided, three predicates are called in the calling module. opt_type/3 must be defined, the others need not. Note that these three predicates may be defined as multifile to allow multiple modules contributing to the provided commandline options. Defining them as discontiguous allows for creating blocks that describe a group of related options.
-
.
A single character implies a short option, multiple a long option. Long
options use _
as word separator, user options may
use either _
or -
. Type is one of:
|
Bnonneg|boolean
, for an option http
handles --http
as http(true)
, --no-http
as http(false)
and --http=3000
as http(3000)
. Note that with
an optional boolean a option is considered boolean unless it has a value
written as
--longopt=value
.--opt=value
notation. This explicit value
specification converts true
, True
,
TRUE
, on
, On
, ON
, 1
and the obvious false equivalents to Prolog true
or false
.
If the option is specified, Default is used. If --no-opt
or
--noopt
is used, the inverse of Default is used.integer
. Requires value >=
0.integer
. Requires value >=
1.float
,
else convert as integer
. Then check the range.atom
, but requires the value to be a member of List
(enum type).file
file
, and check access using access_file/2.
A value -
is not checked for access, assuming the
application handles this as standard input or output.directory
, and check access. Access is one of read
write
or create
. In the latter case the parent
directory must exist and have write access.term
, but passes Options to term_string/3.
If the option
variable_names(Bindings)
is given the option value is set
to the pair Term-Bindings
.FILE
in e.g. -f FILE
.
By default, -h
, -?
and --help
are bound to help. If
opt_type(Opt, help, boolean)
is true for some Opt,
the default help binding and help message are disabled and the normal
user rules apply. In particular, the user should also provide a rule for
opt_help(help, String)
.