mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 12:45:59 +01:00
core: add a --systeminfo parameter to gather systeminfo without running
This commit is contained in:
parent
2320b2241c
commit
2a052c69f3
3 changed files with 15 additions and 4 deletions
|
@ -943,11 +943,14 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
||||||
|
|
||||||
result += "plugins:\n";
|
result += "plugins:\n";
|
||||||
|
if (g_pPluginSystem) {
|
||||||
for (auto const& pl : g_pPluginSystem->getAllPlugins()) {
|
for (auto const& pl : g_pPluginSystem->getAllPlugins()) {
|
||||||
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
|
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
result += "\tunknown: not runtime\n";
|
||||||
|
|
||||||
if (g_pHyprCtl->m_sCurrentRequestParams.sysInfoConfig) {
|
if (g_pHyprCtl && g_pHyprCtl->m_sCurrentRequestParams.sysInfoConfig) {
|
||||||
result += "\n======Config-Start======\n";
|
result += "\n======Config-Start======\n";
|
||||||
result += g_pConfigManager->getConfigString();
|
result += g_pConfigManager->getConfigString();
|
||||||
result += "\n======Config-End========\n";
|
result += "\n======Config-End========\n";
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include "../helpers/MiscFunctions.hpp"
|
#include "../helpers/MiscFunctions.hpp"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
// exposed for main.cpp
|
||||||
|
std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request);
|
||||||
|
|
||||||
class CHyprCtl {
|
class CHyprCtl {
|
||||||
public:
|
public:
|
||||||
CHyprCtl();
|
CHyprCtl();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Compositor.hpp"
|
#include "Compositor.hpp"
|
||||||
#include "config/ConfigManager.hpp"
|
#include "config/ConfigManager.hpp"
|
||||||
#include "init/initHelpers.hpp"
|
#include "init/initHelpers.hpp"
|
||||||
|
#include "debug/HyprCtl.hpp"
|
||||||
|
|
||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
|
@ -133,6 +134,10 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::cout << result;
|
std::cout << result;
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (it->compare("--systeminfo") == 0) {
|
||||||
|
const auto SYSINFO = systemInfoRequest(eHyprCtlOutputFormat::FORMAT_NORMAL, "");
|
||||||
|
std::cout << SYSINFO << "\n";
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n";
|
std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n";
|
||||||
help();
|
help();
|
||||||
|
|
Loading…
Reference in a new issue