diff options
author | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-05-23 11:12:09 +0100 |
---|---|---|
committer | Francesco Mazzoli <francesco@rabbitmq.com> | 2012-05-23 11:12:09 +0100 |
commit | 121d97a43ccdf61eebf975f5e6f6d20c56167f2e (patch) | |
tree | 3738fd9567d48b377c35f4d8211e6a3208fe7ee7 | |
parent | 50a6a6016f020d637c0be924e250c72543b6075d (diff) | |
download | rabbitmq-server-121d97a43ccdf61eebf975f5e6f6d20c56167f2e.tar.gz |
on a second thought, it is better to reject options with missing arguments
-rw-r--r-- | src/rabbit_misc.erl | 3 | ||||
-rw-r--r-- | src/rabbit_tests.erl | 4 |
2 files changed, 1 insertions, 6 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 661a4cb4..1d7d39e7 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -785,8 +785,7 @@ process_opts(Defs, C, [A | As], Found, KVs, Outs) -> Defs, C, As, Found, dict:store(A, true, KVs), Outs); {option, _, _} -> case As of - [] -> process_opts(Defs, C, [], Found, - KVs, [A | Outs]); + [] -> no_command; [V | As1] -> process_opts( Defs, C, As1, Found, dict:store(A, V, KVs), Outs) diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index 7c287b0a..bae4928d 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -837,10 +837,6 @@ test_arguments_parser() -> %% If the flag "eats" the command, the command won't be recognised check_parse_arguments(no_command, GetOptions, ["-o1", "command1", "quux"]), - %% If the flag doesn't have an argument, it won't be recognised - check_parse_arguments( - {ok, {command1, [{"-f1", false}, {"-o1", "foo"}], ["-o1"]}}, - GetOptions, ["command1", "-o1"]), %% If a flag eats another flag, the eaten flag won't be recognised check_parse_arguments( {ok, {command1, [{"-f1", false}, {"-o1", "-f1"}], []}}, |