MCPcopy Create free account
hub / github.com/node-config/node-config / getCmdLineArg

Method getCmdLineArg

lib/util.js:895–906  ·  view source on GitHub ↗

* Get Command Line Arguments * * * This method allows you to retrieve the value of the specified command line argument. * * * * The argument is case sensitive, and must be of the form '--ARG_NAME=value' * * * @method getCmdLineArg * @param {s

(searchFor)

Source from the content-addressed store, hash-verified

893 * @return {false|string} false if the argument was not found, the argument value if found
894 */
895 getCmdLineArg(searchFor) {
896 const cmdLineArgs = process.argv.slice(2, process.argv.length);
897 const argName = '--' + searchFor + '=';
898
899 for (let argvIt = 0; argvIt < cmdLineArgs.length; argvIt++) {
900 if (cmdLineArgs[argvIt].indexOf(argName) === 0) {
901 return cmdLineArgs[argvIt].substr(argName.length);
902 }
903 }
904
905 return false;
906 }
907
908 /**
909 * <p>Get a Config Environment Variable Value</p>

Callers 3

initParamMethod · 0.95
getCmdLineArgMethod · 0.45
_initFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected