mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
Config CLI: Handle missing config values correctly
If the domain/group/key doesn't exist in the config, exit with non-zero status and don't print out anything. Previously the CLI would print a single empty line if the config value was not found with LibConfig. Now, we use the proper `Config::Client::the().read_string()` API which can return an `Optional` type indicating failure.`
This commit is contained in:
parent
8e90a4fd1c
commit
b0bd4be59a
1 changed files with 4 additions and 3 deletions
|
@ -29,8 +29,9 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
auto value = Config::read_string(domain, group, key);
|
||||
outln("{}", value);
|
||||
|
||||
auto value_or_error = Config::Client::the().read_string_value(domain, group, key);
|
||||
if (!value_or_error.has_value())
|
||||
return 1;
|
||||
outln("{}", value_or_error.value());
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue