Skip to content

Instantly share code, notes, and snippets.

@beatak
Created November 13, 2012 21:58
Show Gist options
  • Save beatak/4068693 to your computer and use it in GitHub Desktop.
Save beatak/4068693 to your computer and use it in GitHub Desktop.
JavaScript file
#!/usr/bin/env node
var cli = require('cli');
var options = cli.parse({
boola: ['b', 'testing boolean value', 'bool', true]
});
console.log(options);
% ./cli_test --help
Usage:
cli [OPTIONS] [ARGS]
Options:
-b, --boola [BOOL] testing boolean value (Default is true)
-h, --help Display help and usage details
% ./cli_test
{ boola: true }
% ./cli -b false
{ boola: true }
% ./cli --boola false
{ boola: true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment