Skip to content

Instantly share code, notes, and snippets.

@korzio
Created January 23, 2019 06:51
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 korzio/cc8e9f5e71cc621f3314de7daada33a4 to your computer and use it in GitHub Desktop.
Save korzio/cc8e9f5e71cc621f3314de7daada33a4 to your computer and use it in GitHub Desktop.
medium-basic-second.js
#!/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