diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07T16·41+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-06-07T16·41+0200 |
commit | 186571965dccf57d15b9f37c1cca92a57187b7b3 (patch) | |
tree | 79c38bc54d9a3e2bbd296a094ca988c13088fb09 /src/libutil/config.cc | |
parent | aa952d5f0bc623a1584f2d589209f586e594c75f (diff) |
Don't show flags from config settings in "nix --help"
Diffstat (limited to 'src/libutil/config.cc')
-rw-r--r-- | src/libutil/config.cc | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/libutil/config.cc b/src/libutil/config.cc index 612fb6e68350..0682bcd5dbc3 100644 --- a/src/libutil/config.cc +++ b/src/libutil/config.cc @@ -115,11 +115,11 @@ void Config::toJSON(JSONObject & out) } } -void Config::convertToArgs(Args & args) +void Config::convertToArgs(Args & args, const std::string & category) { for (auto & s : _settings) if (!s.second.isAlias) - s.second.setting->convertToArg(args); + s.second.setting->convertToArg(args, category); } AbstractSetting::AbstractSetting( @@ -135,7 +135,7 @@ void AbstractSetting::toJSON(JSONPlaceholder & out) out.write(to_string()); } -void AbstractSetting::convertToArg(Args & args) +void AbstractSetting::convertToArg(Args & args, const std::string & category) { } @@ -146,9 +146,14 @@ void BaseSetting<T>::toJSON(JSONPlaceholder & out) } template<typename T> -void BaseSetting<T>::convertToArg(Args & args) +void BaseSetting<T>::convertToArg(Args & args, const std::string & category) { - args.mkFlag(0, name, {}, description, 1, [=](Strings ss) { set(*ss.begin()); }); + args.mkFlag() + .longName(name) + .description(description) + .arity(1) + .handler([=](Strings ss) { set(*ss.begin()); }) + .category(category); } template<> void BaseSetting<std::string>::set(const std::string & str) @@ -191,10 +196,18 @@ template<> std::string BaseSetting<bool>::to_string() return value ? "true" : "false"; } -template<> void BaseSetting<bool>::convertToArg(Args & args) +template<> void BaseSetting<bool>::convertToArg(Args & args, const std::string & category) { - args.mkFlag(0, name, {}, description, 0, [=](Strings ss) { value = true; }); - args.mkFlag(0, "no-" + name, {}, description, 0, [=](Strings ss) { value = false; }); + args.mkFlag() + .longName(name) + .description(description) + .handler([=](Strings ss) { value = true; }) + .category(category); + args.mkFlag() + .longName("no-" + name) + .description(description) + .handler([=](Strings ss) { value = false; }) + .category(category); } template<> void BaseSetting<Strings>::set(const std::string & str) |