diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-05-21 01:11:49 +0100 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-05-21 01:11:49 +0100 |
commit | 1fa3e21e8e1fb61bcd18483a0c3b9c3c29027d36 (patch) | |
tree | 497029b372d10255ee855259be2e7efc77f7d3de /src/rabbit_plugins.erl | |
parent | d1d797dafa21c74038da17a988d1df0c8d926dcf (diff) | |
download | rabbitmq-server-1fa3e21e8e1fb61bcd18483a0c3b9c3c29027d36.tar.gz |
simplify `rabbit_misc:get_options/4'
Incidentally, it is also much more efficient (not that it matters).
I will probably rename it to something like `parse_arguments'.
`CommandOpts' and `GlobalOpts' could be one, but I think that `GlobalOpts'
is really useful since adding the global options to each single command
is a pain. We could, obviously, put them together in a tuple, but then
it's not that different from two separate arguments.
Diffstat (limited to 'src/rabbit_plugins.erl')
-rw-r--r-- | src/rabbit_plugins.erl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 53639dc1..c05cee72 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -61,9 +61,9 @@ start() -> {?ENABLED_ALL_OPT, flag}], init:get_plain_arguments()) of - {ok, Res} -> Res; - {invalid, Err} -> rabbit_misc:handle_invalid_arguments(Err), - usage() + {ok, Res} -> Res; + no_command -> print_error("could not recognise command", []), + usage() end, PrintInvalidCommandError = @@ -71,7 +71,7 @@ start() -> print_error("invalid command '~s'", [string:join([atom_to_list(Command) | Args], " ")]) end, - + case catch action(Command, Args, Opts, PluginsFile, PluginsDir) of ok -> rabbit_misc:quit(0); @@ -407,4 +407,3 @@ report_change() -> _ -> ok end. - |