import { Command } from 'commander'; import { startClient } from '../client/index.js'; import { runClientConfigWizard } from '../config/wizard-client.js'; import { runServerConfigWizard } from '../config/wizard-server.js'; import { startServer } from '../server/index.js'; import { installClientSystemd, installServerSystemd } from '../systemd/installer.js'; export function cli() { const program = new Command(); program .name('usbip-supervisor') .description('USB/IP supervisor system for automatic device management') .version('0.1.0'); // Server command program .command('server') .description('Start the USB/IP supervisor server') .option('-c, --config ', 'Path to config file') .option('--configure', 'Run configuration wizard') .option('--install-systemd', 'Install systemd service') .action(async (options) => { if (options.installSystemd) { await installServerSystemd(); return; } if (options.configure) { await runServerConfigWizard(); return; } await startServer(options.config); }); // Client command program .command('client') .description('Start the USB/IP supervisor client') .option('-c, --config ', 'Path to config file') .option('--configure', 'Run configuration wizard') .option('--install-systemd', 'Install systemd service') .action(async (options) => { if (options.installSystemd) { await installClientSystemd(); return; } if (options.configure) { await runClientConfigWizard(); return; } await startClient(options.config); }); program.parse(); }