commands/systemd: init

This commit is contained in:
2024-06-18 02:01:31 +08:00
parent b0730a8945
commit b4a0b1e7ef

31
commands/systemd.ts Normal file
View File

@@ -0,0 +1,31 @@
import { optFlag, optSwitch } from "./common";
export interface SystemdRunOptions {
/**
* Create a transient .scope unit instead of the default transient .service unit (see above).
*
* @since 206
*/
scope?: boolean;
/**
* Use this unit name instead of an automatically generated one.
*
* @since 206
*/
unit?: string;
/**
* Talk to the service manager of the calling user, rather than the service manager of the system.
*/
user?: boolean;
}
export function systemdRunOptions(o: SystemdRunOptions): string[] {
return [
...optSwitch("--scope", o.scope),
...optFlag("--unit", o.unit),
...optSwitch("--user", o.user),
];
}