diff options
author | alois31 <alois1@gmx-topmail.de> | 2024-10-23 15:20:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-10-23 15:20:51 +0000 |
commit | 2734a9cf94debc6baef4e7d4d9fa28cc28f5b31d (patch) | |
tree | ba6be97cc5ac268941b1c8ac10507786a720357c /src/libutil/config-impl.hh | |
parent | 5f1344dd8aec59ce654a0fac30b1842e2e68299c (diff) | |
parent | 689eb45630a183f0fbbd8864cb7a3c7cb1704451 (diff) |
* changes:
treewide: make more settings conditionally available
libstore/build: only send overridden settings to the build hook
treewide: consistently mark overridden settings as such
Diffstat (limited to 'src/libutil/config-impl.hh')
-rw-r--r-- | src/libutil/config-impl.hh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libutil/config-impl.hh b/src/libutil/config-impl.hh index 748107b6e..2342c9a03 100644 --- a/src/libutil/config-impl.hh +++ b/src/libutil/config-impl.hh @@ -65,6 +65,7 @@ void BaseSetting<T>::appendOrSet(T newValue, bool append, const ApplyConfigOptio "using default `appendOrSet` implementation with an appendable type"); assert(!append); + overridden = true; value = std::move(newValue); } @@ -85,6 +86,13 @@ void BaseSetting<T>::set(const std::string & str, bool append, const ApplyConfig } } +template<typename T> +void BaseSetting<T>::override(const T & v) +{ + overridden = true; + value = v; +} + template<> void BaseSetting<bool>::convertToArg(Args & args, const std::string & category); template<typename T> @@ -95,7 +103,7 @@ void BaseSetting<T>::convertToArg(Args & args, const std::string & category) .description = fmt("Set the `%s` setting.", name), .category = category, .labels = {"value"}, - .handler = {[this](std::string s) { overridden = true; set(s); }}, + .handler = {[this](std::string s) { set(s); }}, .experimentalFeature = experimentalFeature, }); @@ -105,7 +113,7 @@ void BaseSetting<T>::convertToArg(Args & args, const std::string & category) .description = fmt("Append to the `%s` setting.", name), .category = category, .labels = {"value"}, - .handler = {[this](std::string s) { overridden = true; set(s, true); }}, + .handler = {[this](std::string s) { set(s, true); }}, .experimentalFeature = experimentalFeature, }); } |