refactor(cli): extract common command options into reusable helpers

This commit is contained in:
Mohamed Boudra
2026-03-11 21:08:08 +07:00
parent b60d253926
commit e2cb67462d
9 changed files with 323 additions and 312 deletions
+5 -3
View File
@@ -1,6 +1,7 @@
import { Command } from 'commander'
import chalk from 'chalk'
import { generateLocalPairingOffer, loadConfig, resolvePaseoHome } from '@getpaseo/server'
import { addJsonOption } from '../../utils/command-options.js'
interface PairOptions {
home?: string
@@ -8,9 +9,10 @@ interface PairOptions {
}
export function pairCommand(): Command {
return new Command('pair')
.description('Print the daemon pairing QR code and link')
.option('--json', 'Output in JSON format')
return addJsonOption(
new Command('pair')
.description('Print the daemon pairing QR code and link')
)
.option('--home <path>', 'Paseo home directory (default: ~/.paseo)')
.action(async (_options: PairOptions, command: Command) => {
await runPairCommand(command.optsWithGlobals() as PairOptions)