added pkg build for project
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user