Last active
November 7, 2018 22:28
-
-
Save jgwill/e37568ba50bd2adf2eb730572b73ef17 to your computer and use it in GitHub Desktop.
NodeJS parse argument using minimist package for Console App
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
// cliapp.js | |
"use strict"; | |
const args = require("minimist")(process.argv.slice(2)); | |
//console.log(args); | |
console.log(args.i); | |
console.log(args.s); |
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
#Install | |
npm install minimist --save |
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
#usage | |
node cliapp.js --i=myIvalue --s=mySValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage. sh