From 3c91f711fc5197fbcdb6712c92c44638d4ad2807 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 20 Jul 2016 21:10:13 +0300 Subject: [PATCH] Warn the user when flag combinations don't make sense --- src/main.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index 020c1e590..8e8ad9b45 100644 --- a/src/main.cc +++ b/src/main.cc @@ -779,7 +779,7 @@ int main(int argc, char* argv[]) if (auto session = parser.get_switch("p")) { - for (auto opt : { "c", "n", "s", "d", "e" }) + for (auto opt : { "c", "n", "s", "d", "e", "ro" }) { if (parser.get_switch(opt)) { @@ -795,6 +795,12 @@ int main(int argc, char* argv[]) if (auto keys = parser.get_switch("f")) { + if (parser.get_switch("ro")) + { + write_stderr("error: -ro makes not sense with -f\n"); + return -1; + } + Vector files; for (size_t i = 0; i < parser.positional_count(); ++i) files.emplace_back(parser[i]); @@ -805,7 +811,7 @@ int main(int argc, char* argv[]) if (auto server_session = parser.get_switch("c")) { - for (auto opt : { "n", "s", "d" }) + for (auto opt : { "n", "s", "d", "ro" }) { if (parser.get_switch(opt)) {