UNPKG

amaran-light-cli

Version:

Command line tool for controlling Aputure Amaran lights via WebSocket to a local Amaran desktop app.

41 lines 1.59 kB
import chalk from 'chalk'; import { getLightDevices } from '../cmdUtils.js'; export function registerList(program, deps) { const { asyncCommand } = deps; program .command('list') .name('list') .usage('[options]') .alias('ls') .description('List all available lights') .option('-u, --url <url>', 'WebSocket URL') .option('-c, --client-id <id>', 'Client ID') .option('-d, --debug', 'Enable debug mode') .action(asyncCommand(handleList(deps))); } function handleList(deps) { const { createController } = deps; return async (options) => { const controller = await createController(options.url, options.clientId, options.debug); try { const devices = getLightDevices(controller.getDevices()); if (devices.length === 0) { console.log(chalk.yellow('No light devices found')); return; } console.log(chalk.blue('Available lights:')); devices.forEach((device, index) => { const displayName = device.device_name || device.name || device.id || device.node_id || 'Unknown'; console.log(`${index + 1}. ${chalk.green(displayName)} (${chalk.gray(device.node_id || device.id || '?')})`); if (device.device_type) { console.log(` Type: ${device.device_type}`); } }); } finally { await controller.disconnect(); } }; } export default registerList; //# sourceMappingURL=list.js.map