Fix bug find target
This commit is contained in:
parent
1df359175e
commit
86a13a1705
|
@ -25,11 +25,13 @@ std::unique_ptr<clippy::targets::RunShellScript> Config::GetTarget(
|
||||||
std::vector<std::string> target_commands;
|
std::vector<std::string> target_commands;
|
||||||
target_commands.emplace_back("cd " + initial_directory_);
|
target_commands.emplace_back("cd " + initial_directory_);
|
||||||
|
|
||||||
bool target_begin = false;
|
bool target_exists = false;
|
||||||
|
bool in_target = false;
|
||||||
|
|
||||||
while (std::getline(in, current)) {
|
while (std::getline(in, current)) {
|
||||||
if (current == target + ":") {
|
if (current == target + ":") {
|
||||||
target_begin = true;
|
target_exists = true;
|
||||||
|
in_target = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,18 +39,18 @@ std::unique_ptr<clippy::targets::RunShellScript> Config::GetTarget(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!std::isspace(current[0]) && target_begin) {
|
if (!std::isspace(current[0])) {
|
||||||
target_begin = false;
|
in_target = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_begin) {
|
if (in_target) {
|
||||||
target_commands.emplace_back(Strip(std::move(current)));
|
target_commands.emplace_back(Strip(std::move(current)));
|
||||||
} else if (current[0] == '!') {
|
} else if (current[0] == '!') {
|
||||||
target_commands.emplace_back(current.substr(1, current.size() - 1));
|
target_commands.emplace_back(current.substr(1, current.size() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target_begin) {
|
if (!target_exists) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue