- Fixing bug that yielded empty expanded command sets.
This commit is contained in:
@@ -17,8 +17,9 @@ namespace daggy {
|
|||||||
std::vector<std::vector<std::string>> commands{{}};
|
std::vector<std::vector<std::string>> commands{{}};
|
||||||
|
|
||||||
for (const auto &part : command) {
|
for (const auto &part : command) {
|
||||||
std::vector<std::string> expandedPart;
|
std::vector<std::string> expandedPart{part};
|
||||||
|
|
||||||
|
// Find all values of parameters, and expand them
|
||||||
for (const auto &[param, paramValue] : parameters) {
|
for (const auto &[param, paramValue] : parameters) {
|
||||||
auto pos = part.find(param);
|
auto pos = part.find(param);
|
||||||
if (pos == std::string::npos) continue;
|
if (pos == std::string::npos) continue;
|
||||||
|
|||||||
@@ -49,10 +49,7 @@ TEST_CASE("Parameter Expansion", "[utilities_parameter_expansion]") {
|
|||||||
// TYPE isn't used, so it's just |DATE| * |SOURCE|
|
// TYPE isn't used, so it's just |DATE| * |SOURCE|
|
||||||
REQUIRE(result.size() == 4);
|
REQUIRE(result.size() == 4);
|
||||||
|
|
||||||
for (const auto &command : result) {
|
|
||||||
std::copy(command.begin(), command.end(), std::ostream_iterator<std::string>(std::cout, " "));
|
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user