Eoptimist - Extended optimist
Note: Please consider using Easy CLI instead. Easy CLI is a project which emerged from this one.
-
Automatically scans (if exists)
package.jsonfile and adds--version(alias--info) CLI option that displays string:// e.g. "example-program 0.1.0" package.json.name + " " + package.json.version -
Automatically scans (if exists)
CLI.yamlfile and generate--usage(alias--help) CLI option usingCLI.yamlkeys.Example:
We have
./CLI.yaml,./example-program.jswhich is node application witheoptimistinstalled (i.e. we have executed./npm install optimist)./* example-program.js */ // same as require('optimist').argv var argv = require('eoptimist').argv--
# CLI.yaml name: example-program.js usage: example-program.js [options] [file] options: h4x: alias: h description: omgh4x wat: alias: - is - dis description: [] boolean: true include FILE: description: My awesome description. examples: - node example-program.js --h4x awesome.js - node example-program.js --include file.js--
$ node example-program.js --usage Usage: example-program.js [options] [file] Options: --version, --info Display current version [boolean] --usage, --help Display help [boolean] --h4x, -h omgh4x --wat, --is, --dis [boolean] --include FILE My awesome description. Examples: node example-program.js --h4x awesome.js node example-program.js --include file.js--
$ node example-program.js --version example-program 0.1.0
npm install eoptimist
or
git clone https://github.com/jan-swiecki/node-eoptimist
mkdir node_modules
mv node-eoptimist node_modules/eoptimist
cd node_modules/eoptimist
npm install
(On windows use move instead of mv)