vamtiger-argv
This contains convenience methods for accessing commandline arguments.
Last updated a year ago by vamtiger-project .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vamtiger-argv 
SYNC missed versions from official npm registry.

VAMTIGER Argv

This defines a class for conveniently accessing command-line arguments.

Installation

VAMTIGER Argv can be installed using npm or yarn:

npm i --save vamtiger-argv

or

yarn add vamtiger-argv

Usage

Import or require a referece to VAMTIGER Argv:

import Args = require('vamtiger-argv');

or

const Args = require('vamtiger-argv');

Any Node.js script can be executed with commandline arguments.

node someNodeProgram.js --someArgument someValue --anotherArg anotherValue1 --anotherArg anotherValue2

Commandline arguments can then be referenced by name using the get method.

const args = new Args();

args.get('someArgument'); // someValue
args.getAll('anotherArg'); // ['anotherValue1', 'anotherValue2']

The first argument be referenced by using the first method.

argv.first(); // --someArgument

Raw commandline arguments can also be referenced by using the next method.

args.next('--someArgument'); // someValue

The has method can be used to check whether a commandline arguments is present.

args.has('someArgument'); // true
args.has('--someArgument'); // true
args.has('someValue'); // true
args.has('someOtherArgument'); // false

Current Tags

  • 1.2.6                                ...           latest (a year ago)

13 Versions

  • 1.2.6                                ...           a year ago
  • 1.2.5                                ...           a year ago
  • 1.2.4                                ...           a year ago
  • 1.2.3                                ...           2 years ago
  • 1.2.2                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.0                                ...           4 years ago

Copyright 2014 - 2016 © taobao.org |