UNPKG

matterbridge-roborock-vacuum-plugin

Version:
29 lines 830 B
import readline from 'node:readline'; export function parseArgs(args) { const result = {}; for (let i = 0; i < args.length; i++) { const key = args[i]; if (!key.startsWith('--')) continue; const name = key.slice(2); const next = args[i + 1]; if (next !== undefined && !next.startsWith('--')) { result[name] = next; i++; } else { result[name] = 'true'; } } return result; } export async function prompt(question) { const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); return new Promise((resolve) => { rl.question(question, (answer) => { rl.close(); resolve(answer.trim()); }); }); } //# sourceMappingURL=utils.js.map