init
This commit is contained in:
commit
44825c4c31
11 changed files with 247 additions and 0 deletions
31
control.ts
Executable file
31
control.ts
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/env -S deno run -A --unstable
|
||||
|
||||
import { daemon_send, new_cmd_disable, new_cmd_enable, new_cmd_status } from "./src/lib.ts";
|
||||
import { socket_path } from "./src/lib/paths.ts";
|
||||
|
||||
await main();
|
||||
async function main() {
|
||||
const [kind, ...rest] = Deno.args;
|
||||
|
||||
if (kind === "status") {
|
||||
const res = await daemon_send(socket_path(), new_cmd_status());
|
||||
console.log({ res });
|
||||
}
|
||||
|
||||
if (kind === "enable") {
|
||||
const [name] = rest;
|
||||
const res = await daemon_send(socket_path(), new_cmd_enable(name));
|
||||
console.log({ res });
|
||||
}
|
||||
|
||||
if (kind === "disable") {
|
||||
const [name] = rest;
|
||||
const res = await daemon_send(socket_path(), new_cmd_disable(name));
|
||||
console.log({ res });
|
||||
}
|
||||
|
||||
if (kind === "stop") {
|
||||
const res = await daemon_send(socket_path(), new_cmd_status());
|
||||
console.log({ res });
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue