UNPKG

@destdefe/dev-utils

Version:

18 lines (16 loc) 454 B
const xargs = () => { const [nodePath, binPath, ...args] = process.argv; const argv = {}; const commands = []; args.map(arg => { if (arg.startsWith('--')) { const [propName, propValue] = arg.split('='); const newPropName = propName.replace("--", ''); argv[newPropName] = propValue; } else { commands.push(arg); } }) return { args, argv, commands, node: nodePath, bin: binPath } }; module.exports = xargs;