From 51f707d60785283c582c16c141ab6832a744dd3a Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 19 Jan 2011 11:37:29 +0100 Subject: [PATCH] Make boolean option togglable. --- options.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/options.cpp b/options.cpp index 8ef0acf..89f8b18 100644 --- a/options.cpp +++ b/options.cpp @@ -188,10 +188,10 @@ bool opt::parse_args(int* argc, char* argv[]) && result; break; case 'b': - opt::bookkeeping = true; + opt::bookkeeping = !opt::bookkeeping; break; case 'e': - opt::exit_on_close = true; + opt::exit_on_close = !opt::exit_on_close; break; case 'h': opt::help_requested++; @@ -354,7 +354,8 @@ void opt::usage() << " [" << opt::loba_algo << "]\n"; if (opt::help_requested > 1) so_list(opt::loba_algorithms); - std::clog << o("-b") << "enable bookkeeping (\"virtual load\")\n"; + std::clog << o("-b") << "toggle bookkeeping (\"virtual load\")" + << " [" << opt_helper::on_off(opt::bookkeeping) << "]\n"; std::clog << "\nApplication parameters\n"; std::clog << o("-c [fn,...]f0") @@ -377,7 +378,8 @@ void opt::usage() std::clog << o("-t value") << "time limit (simulated time), 0 for infinity" << " [" << opt::time_limit << "]\n"; - std::clog << o("-e") << "exit on reception of \"close\" message\n"; + std::clog << o("-e") << "toggle exit on reception of \"close\" message" + << " [" << opt_helper::on_off(opt::exit_on_close) << "]\n"; if (opt::help_requested < 3) return; -- 2.39.5