Hyprdoctor/main.cpp

29 lines
787 B
C++
Raw Normal View History

2023-11-30 18:31:41 +00:00
#include "src/utils/environment.h"
#include "src/utils/file_parser.h"
#include "src/utils/json_parser.h"
2023-11-30 17:54:31 +00:00
#include <iostream>
int main() {
const char *envVar = getEnvVar("HYPRLAND_INSTANCE_SIGNATURE");
2023-11-30 17:54:31 +00:00
2023-11-30 18:31:41 +00:00
// try opening the log file
2023-11-30 17:54:31 +00:00
try {
std::string filePath = "/tmp/hypr/" + std::string(envVar);
std::vector<std::string> errLines = readErrLines(filePath);
// associate each error with the issue ID and name
std::vector<std::pair<int, std::string>> issues =
findErrorsInJsonFiles(errLines, "database");
for (const auto &[id, name] : issues) {
std::cout << "Issue ID: " << id << ", Name: " << name << std::endl;
2023-11-30 17:54:31 +00:00
}
} catch (const std::runtime_error &e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}