View Source erlarg (erlarg v1.0.1)
Summary
Functions
Retuns the specification for an option Name that doesn't have parameter.
Return the specification for an option Name that must be parsed with Syntax.
Parses arguments into a structured data according to a given
syntaxParses arguments into a structured data according to a given
syntax and aliasesTypes
Functions
-spec opt(Option, Name) -> Return when Option :: option_name() | undefined, Name :: atom(), Return :: opt() | {atom(), syntax()}.
Retuns the specification for an option Name that doesn't have parameter.
--help % also -h
erlarg:opt({"-h", "--help"}, help).
-spec opt(Option, Name, Syntax) -> Return when Option :: option_name() | undefined, Name :: atom(), Syntax :: syntax() | undefined, Return :: opt() | {atom(), syntax()}.
Return the specification for an option Name that must be parsed with Syntax.
date -d 'now'
erlarg:opt({"-d", "--date"}, date, string()).
-spec parse(Args, Syntax) -> Options | Error when Args :: args(), Syntax :: syntax(), Options :: {ok, {any(), args()}}, Error :: error.
syntax
-spec parse(Args, Syntax, Aliases) -> Options | Error when Args :: args(), Syntax :: syntax(), Aliases :: map(), Options :: {ok, {any(), args()}}, Error :: error.
syntax and aliases