vamtiger-argv
TypeScript icon, indicating that this package has built-in type declarations

1.2.6 • Public • Published

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

Package Sidebar

Install

npm i vamtiger-argv

Weekly Downloads

68

Version

1.2.6

License

MIT

Unpacked Size

18.9 kB

Total Files

40

Last publish

Collaborators

  • vamtiger-project