diff --git a/src/clippy/config.cpp b/src/clippy/config.cpp index 1940174..e7499e8 100644 --- a/src/clippy/config.cpp +++ b/src/clippy/config.cpp @@ -25,11 +25,13 @@ std::unique_ptr Config::GetTarget( std::vector target_commands; target_commands.emplace_back("cd " + initial_directory_); - bool target_begin = false; + bool target_exists = false; + bool in_target = false; while (std::getline(in, current)) { if (current == target + ":") { - target_begin = true; + target_exists = true; + in_target = true; continue; } @@ -37,18 +39,18 @@ std::unique_ptr Config::GetTarget( continue; } - if (!std::isspace(current[0]) && target_begin) { - target_begin = false; + if (!std::isspace(current[0])) { + in_target = false; } - if (target_begin) { + if (in_target) { target_commands.emplace_back(Strip(std::move(current))); } else if (current[0] == '!') { target_commands.emplace_back(current.substr(1, current.size() - 1)); } } - if (!target_begin) { + if (!target_exists) { return nullptr; }