Warn if a configurable option is not recognized
This commit is contained in:
@@ -105,6 +105,8 @@ void string_f(std::unordered_map<std::string, std::string> &vars, const std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
input = std::move(it->second);
|
input = std::move(it->second);
|
||||||
|
|
||||||
|
vars.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_restricted_f(std::unordered_map<std::string, std::string> &vars, const std::string &name, std::string &input, const std::vector<std::string_view> &allowed_vals) {
|
void string_restricted_f(std::unordered_map<std::string, std::string> &vars, const std::string &name, std::string &input, const std::vector<std::string_view> &allowed_vals) {
|
||||||
@@ -128,6 +130,8 @@ void int_f(std::unordered_map<std::string, std::string> &vars, const std::string
|
|||||||
|
|
||||||
auto &val = it->second;
|
auto &val = it->second;
|
||||||
input = util::from_chars(&val[0], &val[0] + val.size());
|
input = util::from_chars(&val[0], &val[0] + val.size());
|
||||||
|
|
||||||
|
vars.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void int_between_f(std::unordered_map<std::string, std::string> &vars, const std::string &name, int &input, const std::pair<int, int> &range) {
|
void int_between_f(std::unordered_map<std::string, std::string> &vars, const std::string &name, int &input, const std::pair<int, int> &range) {
|
||||||
@@ -220,6 +224,12 @@ void parse_file(const char *file) {
|
|||||||
sunshine.min_log_level = 6;
|
sunshine.min_log_level = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(sunshine.min_log_level <= 3) {
|
||||||
|
for(auto &[var,_] : vars) {
|
||||||
|
std::cout << "Warning: Unrecognized configurable option ["sv << var << ']' << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user