Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Aug 27, 2024
1 parent 5c1fbcf commit a39267a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/debug/HyprCtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,29 +972,24 @@ std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
// Find the first space to strip the keyword keyword
auto const firstSpacePos = in.find_first_of(' ');
if (firstSpacePos == std::string::npos) {
// Handle the case where there's no space found (invalid input)
if (firstSpacePos == std::string::npos) // Handle the case where there's no space found (invalid input)
return "Invalid input: no space found";
}

// Strip the keyword
in = in.substr(firstSpacePos + 1);

// Find the next space for the COMMAND and VALUE
auto const secondSpacePos = in.find_first_of(' ');
if (secondSpacePos == std::string::npos) {
// Handle the case where there's no second space (invalid input)
if (secondSpacePos == std::string::npos) // Handle the case where there's no second space (invalid input)
return "Invalid input: command and value not properly formatted";
}

// Extract COMMAND and VALUE
const auto COMMAND = in.substr(0, secondSpacePos);
const auto VALUE = in.substr(secondSpacePos + 1);

// If either COMMAND or VALUE is empty, handle accordingly
if (COMMAND.empty() || VALUE.empty()) {
if (COMMAND.empty() || VALUE.empty())
return "Invalid input: command or value is empty";
}

std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE);

Expand Down

0 comments on commit a39267a

Please sign in to comment.