1import { DesktopCliCommandStateSchema } from "@t3tools/contracts";
2import * as Effect from "effect/Effect";
3import * as Schema from "effect/Schema";
4
5import * as DesktopCliCommand from "../../app/DesktopCliCommand.ts";
6import * as IpcChannels from "../channels.ts";
7import { makeIpcMethod } from "../DesktopIpc.ts";
8
9export const getCliCommandState = makeIpcMethod({
10 channel: IpcChannels.CLI_COMMAND_GET_STATE_CHANNEL,
11 payload: Schema.Void,
12 result: DesktopCliCommandStateSchema,
13 handler: Effect.fn("desktop.ipc.cliCommand.getState")(function* () {
14 return yield* (yield* DesktopCliCommand.DesktopCliCommand).state;
15 }),
16});
17
18export const installCliCommand = makeIpcMethod({
19 channel: IpcChannels.CLI_COMMAND_INSTALL_CHANNEL,
20 payload: Schema.Void,
21 result: DesktopCliCommandStateSchema,
22 handler: Effect.fn("desktop.ipc.cliCommand.install")(function* () {
23 return yield* (yield* DesktopCliCommand.DesktopCliCommand).install;
24 }),
25});
26
27export const uninstallCliCommand = makeIpcMethod({
28 channel: IpcChannels.CLI_COMMAND_UNINSTALL_CHANNEL,
29 payload: Schema.Void,
30 result: DesktopCliCommandStateSchema,
31 handler: Effect.fn("desktop.ipc.cliCommand.uninstall")(function* () {
32 return yield* (yield* DesktopCliCommand.DesktopCliCommand).uninstall;
33 }),
34});