UNPKG

amaran-light-cli

Version:

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

29 lines 1.06 kB
import chalk from 'chalk'; import { discoverLocalWebSocket } from '../../deviceControl/discovery.js'; export function registerDiscover(program, deps) { const { asyncCommand } = deps; program .command('discover') .usage('[options]') .description('Discover local Amaran WebSocket endpoint') .option('-d, --debug', 'Enable debug output') .action(asyncCommand(handleDiscover(deps))); } function handleDiscover(deps) { const { saveWsUrl } = deps; return async (options) => { const res = await discoverLocalWebSocket('127.0.0.1', !!options.debug); if (res) { console.log(chalk.green(`Found WebSocket: ${res.url} (process: ${res.process})`)); if (saveWsUrl) { saveWsUrl(res.url); console.log(chalk.green('Saved to configuration.')); } } else { console.log(chalk.yellow('No local Amaran WebSocket found via lsof')); } }; } export default registerDiscover; //# sourceMappingURL=discover.js.map