Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

cliCommand.ts

43 lines1.6 KB

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});
35​
36export const addCliCommandToPath = makeIpcMethod({
37 channel: IpcChannels.CLI_COMMAND_ADD_TO_PATH_CHANNEL,
38 payload: Schema.Void,
39 result: DesktopCliCommandStateSchema,
40 handler: Effect.fn("desktop.ipc.cliCommand.addToPath")(function* () {
41 return yield* (yield* DesktopCliCommand.DesktopCliCommand).addToPath;
42 }),
43});