UNPKG

nve

Version:

Run any command on specific Node.js versions

21 lines (15 loc) 541 B
import{excludeKeys}from"filter-obj"; export const parseOpts=(opts,yargs)=>{ const optsA=yargs.parse(opts); const optsB=excludeKeys(optsA,isInternalOpt); const optsC={...DEFAULT_CLI_OPTS,...optsB}; const{continue:continueOpt,parallel,...optsD}=optsC; return{opts:optsD,continueOpt,parallel} }; const isInternalOpt=(key,value)=> value===undefined|| INTERNAL_KEYS.has(key)|| key.length===1|| key.includes("-"); const INTERNAL_KEYS=new Set(["help","version","_","$0"]); const DEFAULT_CLI_OPTS={progress:true,continue:false,parallel:false};