in hub-pull.js [17:46]
function parseArgs() {
const known = ['components', 'show', 'debug', 'trace', 'force'];
const argv = [];
const opts = {};
let skip = false;
process.argv.slice(2).forEach((arg, i, args) => {
if (arg.startsWith('--')) {
const [k, v = true] = arg.substr(2).split('=');
opts[k] = v;
} else if (arg.startsWith('-')) {
let k = arg.substr(1);
k = known.find((w) => w.startsWith(k)) || k;
let v = args[i + 1];
skip = true;
if (!v || (v && v.startsWith('-'))) v = true;
opts[k] = v;
} else {
if (!skip) argv.push(arg);
skip = false;
}
});
const extra = difference(Object.keys(opts), known);
if (extra.length) {
console.log(`error: unknown command-line argument: ${extra.join(' ')}`);
usage();
}
if (opts.trace) opts.debug = true;
if (opts.components) opts.components = opts.components.split(',');
return {argv, opts};
}