Skip to content

Commit

Permalink
Merge remote-tracking branch 'dev-1/commandlinesplit' into commandlin…
Browse files Browse the repository at this point in the history
…esplit
  • Loading branch information
pflanze committed Dec 3, 2024
2 parents 304c304 + 0cb5777 commit 4ac9db4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/config/source/command_line_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ std::string CommandLineArguments::configKeyPathToString(const ConfigKeyPath& key

AmbiguousConfigKeyPath CommandLineArguments::stringToConfigKeyPath(const std::string& option) {
if (option.size() < 3 || !option.starts_with("--")) {
throw silo::config::ConfigException(
fmt::format("the provided option '{}' is not a valid command line option"
" as silo currently only accepts long-form options starting with '--'",
option)
);
throw silo::config::ConfigException(fmt::format(
"the provided option '{}' is not a valid command line option"
" as silo currently only accepts long-form options starting with '--'",
option
));
}
std::string trimmed = option.substr(2);

Expand All @@ -39,11 +39,11 @@ AmbiguousConfigKeyPath CommandLineArguments::stringToConfigKeyPath(const std::st

for (const auto& token : tokens) {
if (token.empty()) {
throw silo::config::ConfigException(
fmt::format("the provided option '{}' is not a valid command line option"
" because it contains an empty string segment between '-'",
option)
);
throw silo::config::ConfigException(fmt::format(
"the provided option '{}' is not a valid command line option"
" because it contains an empty string segment between '-'",
option
));
}
delimited_strings.push_back(token);
}
Expand Down
5 changes: 2 additions & 3 deletions src/config/source/yaml_file.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ TEST(YamlFile, configKeyPathToString) {
}

TEST(YamlFile, validRoundTrip) {
auto under_test = std::vector<std::string>{
"test", "somethingElse.that.is.quiteLong", "a.2.3.4", "asd", "aa"
};
auto under_test =
std::vector<std::string>{"test", "somethingElse.that.is.quiteLong", "a.2.3.4", "asd", "aa"};
for (const auto& string : under_test) {
ASSERT_EQ(YamlFile::configKeyPathToString(YamlFile::stringToConfigKeyPath(string)), string);
}
Expand Down

0 comments on commit 4ac9db4

Please sign in to comment.