Skip to content

Instantly share code, notes, and snippets.

@picpoint
Created June 8, 2019 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save picpoint/c38c51281d544a4ad72c5f6ab58cf0fd to your computer and use it in GitHub Desktop.
Save picpoint/c38c51281d544a4ad72c5f6ab58cf0fd to your computer and use it in GitHub Desktop.
Work to flags command line
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