Created
January 23, 2019 06:51
-
-
Save korzio/cc8e9f5e71cc621f3314de7daada33a4 to your computer and use it in GitHub Desktop.
medium-basic-second.js
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
#!/usr/bin/env node | |
const { description, name, version } = require('./package.json') | |
const options = process.argv.slice(2) | |
const VERSION_MESSAGE = `${name} ${version}` | |
const HELP_MESSAGE = `${VERSION_MESSAGE} | |
${description} | |
Usage: | |
--help Help documentation | |
--version Installed package version` | |
if (options.includes('--version')) { | |
console.log(VERSION_MESSAGE) | |
} else { | |
console.log(HELP_MESSAGE) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment