Created
June 8, 2019 07:58
-
-
Save picpoint/c38c51281d544a4ad72c5f6ab58cf0fd to your computer and use it in GitHub Desktop.
Work to flags command line
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
function getValue (flag) { | |
const index = process.argv.indexOf(flag); | |
if (index > -1) { | |
return process.argv[index + 1]; | |
} | |
} | |
const name = getValue('-n'); | |
const mesage = getValue('-m'); | |
console.log(`${mesage} ${name}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment