diff options
author | Sage Weil <sage@newdream.net> | 2011-11-18 11:04:24 -0800 |
---|---|---|
committer | Sage Weil <sage.weil@dreamhost.com> | 2011-11-19 13:56:21 -0800 |
commit | 9920a168c59807083019c62fdf381434edea12e5 (patch) | |
tree | 6838cd26bb3fb1121404051cd9a0c9066b062363 | |
parent | 1a468c7e0b1f47937a189c9057e70dcdefa81dc7 (diff) | |
download | ceph-9920a168c59807083019c62fdf381434edea12e5.tar.gz |
config: support --no-<foo> for bool options
Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r-- | src/common/config.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/common/config.cc b/src/common/config.cc index bd607c5bda3..4c2bc0d9018 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -297,10 +297,18 @@ int md_config_t::parse_argv(std::vector<const char*>& args) const config_option *opt = config_optionsp + o; std::string as_option("--"); as_option += opt->name; - if ((opt->type == OPT_BOOL) && - ceph_argparse_flag(args, i, as_option.c_str(), (char*)NULL)) { - set_val_impl("true", opt); - break; + + if (opt->type == OPT_BOOL) { + if (ceph_argparse_flag(args, i, as_option.c_str(), (char*)NULL)) { + set_val_impl("true", opt); + break; + } + std::string no_option("--no-"); + no_option += opt->name; + if (ceph_argparse_flag(args, i, no_option.c_str(), (char*)NULL)) { + set_val_impl("false", opt); + break; + } } else if (ceph_argparse_witharg(args, i, &val, as_option.c_str(), (char*)NULL)) { |