From: Arnaud Giersch Date: Wed, 19 Jan 2011 10:37:29 +0000 (+0100) Subject: Make boolean option togglable. X-Git-Tag: v0.1~188^2~25 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/51f707d60785283c582c16c141ab6832a744dd3a?ds=sidebyside;hp=-c Make boolean option togglable. --- 51f707d60785283c582c16c141ab6832a744dd3a 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;