import { runElectron } from './electron' import { runInstallDesktop } from './install-desktop' interface DesktopOptions { port?: number device?: string } function printHelp(): void { console.log(` rnx desktop — launch or install the desktop companion usage: rnx desktop [options] rnx desktop install [options] options: --port connect to a running dev server on this port --profile launch with an isolated persistent storage profile --ephemeral launch with a temporary isolated storage profile -y, --yes install without prompting `) } export async function runDesktop(args: string[], opts: DesktopOptions): Promise { if (args.includes('--help') || args.includes('-h')) { printHelp() return } const sub = args.find((arg) => !arg.startsWith('-')) if (sub === 'install') { const index = args.indexOf(sub) await runInstallDesktop([...args.slice(0, index), ...args.slice(index + 1)]) return } await runElectron(args, opts) }