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:
;
or
const Args = ;
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 = ; args; // someValueargs; // ['anotherValue1', 'anotherValue2']
The first argument be referenced by using the first method.
argv; // --someArgument
Raw commandline arguments can also be referenced by using the next method.
argsnext'--someArgument'; // someValue
The has method can be used to check whether a commandline arguments is present.
args; // trueargs; // trueargs; // trueargs; // false