Files
paseo/packages/cli/src/utils/command-options.ts
2026-03-21 20:22:15 +07:00

24 lines
767 B
TypeScript

import type { Command } from "commander";
const JSON_OPTION_DESCRIPTION = "Output in JSON format";
const DAEMON_HOST_OPTION_DESCRIPTION =
"Daemon host target (default: local socket/pipe, then localhost:6767)";
export function collectMultiple(value: string, previous: string[]): string[] {
return previous.concat([value]);
}
export function addJsonOption<T extends Command>(command: T): T {
command.option("--json", JSON_OPTION_DESCRIPTION);
return command;
}
export function addDaemonHostOption<T extends Command>(command: T): T {
command.option("--host <host>", DAEMON_HOST_OPTION_DESCRIPTION);
return command;
}
export function addJsonAndDaemonHostOptions<T extends Command>(command: T): T {
return addDaemonHostOption(addJsonOption(command));
}