added pkg build for project

This commit is contained in:
2025-05-30 12:28:38 +02:00
parent 1e9a377c2a
commit 3d3264d8d6
8 changed files with 59 additions and 24 deletions

View File

@@ -44,7 +44,7 @@ expected<AppSettings, string> AppSettings::loadAppSettings() {
return settings;
}
optional<const std::string&> AppSettings::getId(string_view name){
optional<std::string> AppSettings::getId(string_view name){
for (auto& service : services) {
if(service.name == name) {
return service.service;

View File

@@ -14,7 +14,7 @@ struct Service {
struct AppSettings {
static std::expected<AppSettings, std::string> loadAppSettings();
std::optional<const std::string&> getId(std::string_view name);
std::optional<std::string> getId(std::string_view name);
std::vector<Service> services;
};

View File

@@ -21,6 +21,7 @@ namespace systemd {
void toggle_service(string_view serviceName){
string_view toggle = is_service_active(serviceName) ? "stop" : "start";
const string cmd = format("systemctl {} {}", toggle, serviceName);
system(cmd.c_str());
// TODO: add error handling
(void)system(cmd.c_str());
}
}