diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-02 17:59:24 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-08-02 17:59:24 +0100 |
| commit | ee4fa13e7a2a043a2a4840b8f2e04f5742115d3e (patch) | |
| tree | f90a0a0b4003b9ab7e93e11a2270027e2b70b17a /packaging | |
| parent | 49114bb7af82dd73bfd482a8bbd5a135653ffcdf (diff) | |
| download | rabbitmq-server-git-ee4fa13e7a2a043a2a4840b8f2e04f5742115d3e.tar.gz | |
homemade opt parser
It's either this or ~400 lines of code from github under a
non-standard license.
The idea here is that you specify options with tuples like:
- {flag, <flag string>}, or
- {option, <option string>, <default value>}.
Then, you let get_options separate the flags and options from the
arguments.
The spec for get_options is:
get_options/2 :: ([{flag, string()} | {option, string(), any()}],
[string()])
-> {[string()], [{string(), any()}]}
For instance:
get_options([{flag, "-q"}, {option, "-p", "/"}],
["set_permissions","-p","/","guest", "-q",".*",".*",".*"])
== {["set_permissions","guest",".*",".*",".*"],
[{"-q",true},{"-p","/"}]}
Diffstat (limited to 'packaging')
0 files changed, 0 insertions, 0 deletions
