diff options
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, }); } |