Module egetopt

Data Types

args()

args() = [string()]

glyph()

glyph() = 33..126

ASCII printable character, except hyphen.

optarg()

optarg() = undefined | boolean() | non_neg_integer() | string() | [string()]

optlist()

optlist() = [{glyph(), opttype(), optname()}]

optmap()

optmap() = #{glyph() => {optname(), opttype()}}

optname()

optname() = atom()

opts()

opts() = string() | optmap() | optlist()

opttype()

opttype() = count | flag | list | param

ret_err()

ret_err() = {error, string(), glyph()}

ret_map()

ret_map() = #{optname() => optarg()}

ret_ok()

ret_ok(Ret) = {ok, Ret, args()}

ret_plist()

ret_plist() = [{optname(), optarg()}]

Function Index

parse/2
to_map/2

Function Details

parse/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}.

to_map/2

to_map(Args::args(), Opts::opts()) -> ret_ok(ret_map()) | ret_err()


Generated by EDoc