This commit is contained in:
Ali Mirjamali 2025-07-29 11:45:03 +02:00 committed by GitHub
commit 76aa0b1dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -248,6 +248,12 @@ void RootCommand::set_argument_parser() {
throw libdnf5::cli::ArgumentParserError(
M_("{}: Badly formatted argument value \"{}\""), std::string{"setopt"}, std::string(value));
}
if (std::string(value) == std::string("installonly_limit=1"))
throw libdnf5::cli::ArgumentParserInvalidValueError(
M_("Config error: Error parsing --setopt with key 'installonly_limit', "
"value '1': value 1 is not allowed"));
auto key = std::string(value, val);
auto dot_pos = key.rfind('.');
if (dot_pos != std::string::npos) {
@ -1410,6 +1416,10 @@ int main(int argc, char * argv[]) try {
base.setup();
if (base.get_config().get_installonly_limit_option().get_value() == 1)
throw libdnf5::InvalidConfigError(M_(
"Invalid configuration value: installonly_limit=1 in /etc/dnf/dnf.conf; value 1 is not allowed"));
auto & coloring = base.get_config().get_color_option().get_value();
if (coloring == "always") {
libdnf5::cli::tty::coloring_enable(libdnf5::cli::tty::ColoringEnabled::ALWAYS);