Skip to content

Commit

Permalink
chore(web): add better comments to command handler
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Dec 23, 2024
1 parent 09ae1cb commit d85ae04
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion apps/web/src/utils/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { useProviders } from '@/stores/providers'
import { useQueue } from '@/stores/queue'
import { useSettings } from '@/stores/settings'

/**
* Enumeration of commands.
*/
export enum Command {
OPEN = 'open',
CLOSE = 'close',
Expand All @@ -27,8 +30,17 @@ export enum Command {
PURGE_HISTORY = 'purgehistory'
}

/**
* Help information for a command.
*/
export interface CommandHelp {
/**
* The description of the command.
*/
description: string
/**
* The arguments of the command.
*/
args?: string[]
}

Expand Down Expand Up @@ -73,11 +85,17 @@ const help: ComputedRef<Record<Command, CommandHelp>> = computed(() => ({
}
}))

/**
* Handles a command.
* @param event - The event.
* @param command - The command.
* @param args - The command arguments.
*/
export function handleCommand(
event: ClipSourceEvent<ClipSourceMessage>,
command: string,
...args: string[]
) {
): void {
const queue = useQueue()
const settings = useSettings()
switch (command as Command) {
Expand Down

0 comments on commit d85ae04

Please sign in to comment.