args() = [string()]
glyph() = 33..126
ASCII printable character, except hyphen.
optarg() = undefined | boolean() | non_neg_integer() | string() | [string()]
optlist() = [{glyph(), opttype(), optname()}]
optmap() = #{glyph() => {optname(), opttype()}}
optname() = atom()
opts() = string() | optmap() | optlist()
opttype() = count | flag | list | param
ret_err() = {error, string(), glyph()}
ret_map() = #{optname() => optarg()}
ret_ok(Ret) = {ok, Ret, args()}
ret_plist() = [{optname(), optarg()}]
parse/2 | |
to_map/2 |
parse(Args::args(), Opts::opts()) -> ret_ok(ret_plist()) | ret_err()
Args: An argument that starts with a leading hyphen (-
) followed by
a single character, -f
. An option is either an option-flag,
-f
, or option-argument, -x arg
. Option-flags can appear
together in any order as a list, -hfg
; an option-argument can
appear at the end of list of option-flags, -hfgx arg
or
-hfgxarg
. Options can appear in any order until a --
argument is seen, which indicates the remainder are only
arguments.
Opts: An option specification can be one of three formats: a getopt(3)
style string; a mapping of option glyph to option name and type
tuple; or a tuple list of {glyph, type, name}
.
returns:
On success {ok, Plist, ArgsRemaining}
; otherwise {error, Reason, Glyph}
.
Generated by EDoc