JSPM

help-version

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 197
  • Score
    100M100P100Q81229F
  • License MIT

Easily handle --help and --version arguments in your CLI application

Package Exports

  • help-version

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (help-version) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm

help-version

Build Status Dependency Status

Automatic handling of --help and --version arguments for CLI applications.

Example

#!/usr/bin/env node

var helpVersion = require('help-version')(usage());

function usage() {
  return 'Usage:  my-app [file]';
}

helpVersion.version
//=> "v0.1.0"

console.log('main thing');

Catches --help and --version automatically.

$ ./app.js --help
Usage:  my-app [file]
$ ./app.js --version
v0.1.0
$ ./app.js
main thing

API

helpVersion(help, [version])

Checks process.argv for --help or --version, prints help or version if found one.

version defaults to version field from your local package.json.

Returns an object { help: help, version: version }.

Install

npm install help-version

License

MIT