Created
December 8, 2020 03:37
-
-
Save hadeshe93/af6e694777f8da8154ff6fa6d622ae14 to your computer and use it in GitHub Desktop.
Parse process.argv into object which matching the format you need.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getWantedArgvObject = require('./parse-process-argv.js'); | |
const argvObj = getWantedArgvObject(process.argv, { | |
'--deligate-comps': String, | |
// ... | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arg = require('arg'); | |
module.exports = getWantedArgvObject = (processArgv, schema) => { | |
return arg(schema, { permissive: true, argv: processArgv }); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment