Skip to content

Instantly share code, notes, and snippets.

@korzio
Created September 16, 2019 18:09
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/ddf77b7f266ed155a10ba69bdade5a44 to your computer and use it in GitHub Desktop.
Save korzio/ddf77b7f266ed155a10ba69bdade5a44 to your computer and use it in GitHub Desktop.
#!/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