Authors: Juan Jose Comellas (juanjo@comellas.org).
arg_spec() = arg_type() | {arg_type(), arg_value()} | undefined
Option type and optional default argument.
arg_type() = atom | binary | boolean | float | integer | string
Data type that an argument can be converted to.
arg_value() = atom() | binary() | boolean() | float() | integer() | string()
Argument specification.
compound_option() = {atom(), arg_value()}
option() = simple_option() | compound_option()
Command line option specification.
option_spec() = {Name::atom(), Short::char() | undefined, Long::string() | undefined, ArgSpec::arg_spec(), Help::string() | undefined}
output_stream() = standard_io | standard_error
simple_option() = atom()
| check/2 | Check the parsed command line arguments returning ok if all required options (i.e. |
| format_error/2 | Format the error code returned by prior call to parse/2 or check/2. |
| parse/2 | Parse the command line options and arguments returning a list of tuples and/or atoms using the Erlang convention for sending options to a function. |
| parse_and_check/2 | Parse the command line options and arguments returning a list of tuples and/or atoms using the Erlang convention for sending options to a function. |
| tokenize/1 | Tokenize a command line string with support for single and double quoted arguments (needed for arguments that have embedded whitespace). |
| usage/2 | Show a message on standard_error indicating the command line options and arguments that are supported by the program. |
| usage/3 | Show a message on standard_error or standard_io indicating the command line options and arguments that are supported by the program. |
| usage/4 | Show a message on standard_error or standard_io indicating the command line options and arguments that are supported by the program. |
| usage_cmd_line/2 |
check(OptSpecList::[option_spec()], ParsedOpts::[option()]) -> ok | {error, {Reason::atom(), Option::atom()}}
Check the parsed command line arguments returning ok if all required options (i.e. that don't have defaults) are present, and returning error otherwise.
format_error(OptSpecList::[option_spec()], X2::{error, {Reason::atom(), Data::term()}} | {Reason::term(), Data::term()}) -> string()
Format the error code returned by prior call to parse/2 or check/2.
parse(OptSpecList::[option_spec()], CmdLine::string() | [string()]) -> {ok, {[option()], [string()]}} | {error, {Reason::atom(), Data::term()}}
Parse the command line options and arguments returning a list of tuples and/or atoms using the Erlang convention for sending options to a function.
parse_and_check(OptSpecList::[option_spec()], CmdLine::string() | [string()]) -> {ok, {[option()], [string()]}} | {error, {Reason::atom(), Data::term()}}
Parse the command line options and arguments returning a list of tuples and/or atoms using the Erlang convention for sending options to a function. Additionally perform check if all required options (the ones without default values) are present. The function is a combination of two calls: parse/2 and check/2.
tokenize(CmdLine::string()) -> [nonempty_string()]
Tokenize a command line string with support for single and double quoted arguments (needed for arguments that have embedded whitespace). The function also supports the expansion of environment variables in both the Unix (${VAR}; $VAR) and Windows (%VAR%) formats. It does NOT support wildcard expansion of paths.
usage(OptSpecList::[option_spec()], ProgramName::string()) -> ok
Show a message on standard_error indicating the command line options and arguments that are supported by the program.
usage(OptSpecList::[option_spec()], ProgramName::string(), OutputStream::output_stream() | string()) -> ok
Show a message on standard_error or standard_io indicating the command line options and arguments that are supported by the program.
usage(OptSpecList::[option_spec()], ProgramName::string(), CmdLineTail::string(), OutputStream::output_stream() | [{string(), string()}]) -> ok
Show a message on standard_error or standard_io indicating the command line options and arguments that are supported by the program. The CmdLineTail argument is a string that is added to the end of the usage command line.
usage_cmd_line(ProgramName::string(), OptSpecList::[option_spec()]) -> iolist()
Generated by EDoc