refactor(cli): extract common command options into reusable helpers
This commit is contained in:
@@ -2,25 +2,24 @@ import { Command } from 'commander'
|
||||
import { runLsCommand } from './ls.js'
|
||||
import { runModelsCommand } from './models.js'
|
||||
import { withOutput } from '../../output/index.js'
|
||||
import { addJsonAndDaemonHostOptions } from '../../utils/command-options.js'
|
||||
|
||||
export function createProviderCommand(): Command {
|
||||
const provider = new Command('provider').description('Manage agent providers')
|
||||
|
||||
provider
|
||||
.command('ls')
|
||||
.description('List available providers and status')
|
||||
.option('--json', 'Output in JSON format')
|
||||
.option('--host <host>', 'Daemon host target (default: local socket/pipe, then localhost:6767)')
|
||||
.action(withOutput(runLsCommand))
|
||||
addJsonAndDaemonHostOptions(
|
||||
provider
|
||||
.command('ls')
|
||||
.description('List available providers and status')
|
||||
).action(withOutput(runLsCommand))
|
||||
|
||||
provider
|
||||
.command('models')
|
||||
.description('List models for a provider')
|
||||
.argument('<provider>', 'Provider name (claude, codex, opencode)')
|
||||
.option('--thinking', 'Include thinking option IDs for each model')
|
||||
.option('--json', 'Output in JSON format')
|
||||
.option('--host <host>', 'Daemon host target (default: local socket/pipe, then localhost:6767)')
|
||||
.action(withOutput(runModelsCommand))
|
||||
addJsonAndDaemonHostOptions(
|
||||
provider
|
||||
.command('models')
|
||||
.description('List models for a provider')
|
||||
.argument('<provider>', 'Provider name (claude, codex, opencode)')
|
||||
.option('--thinking', 'Include thinking option IDs for each model')
|
||||
).action(withOutput(runModelsCommand))
|
||||
|
||||
return provider
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user