1.0.0 • Published 6 years ago

@wdfang/getcli v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

A command line parser for those who don't like any learning curves.

Installation

$ npm install cli

Usage

Example:

const getcli = require('getcli');

const cli = getcli([
  ['-D', '--delete', 'filename'],
  ['-v', '--verbose', true],
  ['-b', '--brief', 'verbose', false]
]);

if (cli['--delete']) {
  // delete cli.filename
}

Using default values:

const result = getcli([
  ['-u', '--user']
], { user: 'root' });

When running the above with no arguments, result will have the following values:

{ user: 'root', argv: [] }