index.js
function () {
	// looking for keys passed as cli arguments with urls and download-dirs
	const urlsKey = "urls";
	const downloadDirsKey = "download-dirs";
	const destinationDir = "destination-dirs";

	// keys used in the array (same as in configuration via package.json) for each item (so urls => url)
	const confUrlsKey = "url";
	const confDownloadDirsKey = "directory";
	const confDestinationDir = "nodeModulesDir";

	// getting cli arguments
	var argv = require('minimist')(process.argv.slice(2));

	var unjarConfigFromArguments = [];

	if (argv[urlsKey] != null) {
		// only 1 object passed
		if (typeof argv[urlsKey] === 'string') {
			// put into an array, so as it can be used the same way as multiple args
			argv[urlsKey] = [argv[urlsKey]];
			argv[downloadDirsKey] = [argv[downloadDirsKey]];
			argv[destinationDir] = [argv[destinationDir]];
		}

		// put them together so that the array has a object with the attributes: nodeModulesDir, directory, url
		for (var i = 0; i < argv[urlsKey].length; i++) {
			var configItem = {};
			configItem[confUrlsKey] = argv[urlsKey][i];
			configItem[confDownloadDirsKey] = argv[downloadDirsKey][i];
			configItem[confDestinationDir] = argv[destinationDir][i];
			unjarConfigFromArguments.push(configItem);
		}
	}

	return unjarConfigFromArguments;
}
function () {
	// looking for keys passed as cli arguments with urls and download-dirs
	const urlsKey = "urls";
	const downloadDirsKey = "download-dirs";
	const destinationDir = "destination-dirs";

	// keys used in the array (same as in configuration via package.json) for each item (so urls => url)
	const confUrlsKey = "url";
	const confDownloadDirsKey = "directory";
	const confDestinationDir = "nodeModulesDir";

	// getting cli arguments
	var argv = require('minimist')(process.argv.slice(2));

	var unjarConfigFromArguments = [];

	if (argv[urlsKey] != null) {
		// only 1 object passed
		if (typeof argv[urlsKey] === 'string') {
			// put into an array, so as it can be used the same way as multiple args
			argv[urlsKey] = [argv[urlsKey]];
			argv[downloadDirsKey] = [argv[downloadDirsKey]];
			argv[destinationDir] = [argv[destinationDir]];
		}

		// put them together so that the array has a object with the attributes: nodeModulesDir, directory, url
		for (var i = 0; i < argv[urlsKey].length; i++) {
			var configItem = {};
			configItem[confUrlsKey] = argv[urlsKey][i];
			configItem[confDownloadDirsKey] = argv[downloadDirsKey][i];
			configItem[confDestinationDir] = argv[destinationDir][i];
			unjarConfigFromArguments.push(configItem);
		}
	}

	return unjarConfigFromArguments;
}
function ( ) { // looking for keys passed as cli arguments with urls and download-dirs const urlsKey = "urls" ; const downloadDirsKey = "download-dirs" ; const destinationDir = "destination-dirs" ; // keys used in the array (same as in configuration via package.json) for each item (so urls => url) const confUrlsKey = "url" ; const confDownloadDirsKey = "directory" ; const confDestinationDir = "nodeModulesDir" ; // getting cli arguments var argv = require ( 'minimist' ) ( process . argv . slice ( 2 ) ) ; var unjarConfigFromArguments = [ ] ; if ( argv [ urlsKey ] != null ) { // only 1 object passed if ( typeof argv [ urlsKey ] === 'string' ) { // put into an array, so as it can be used the same way as multiple args argv [ urlsKey ] = [ argv [ urlsKey ] ] ; argv [ downloadDirsKey ] = [ argv [ downloadDirsKey ] ] ; argv [ destinationDir ] = [ argv [ destinationDir ] ] ; } // put them together so that the array has a object with the attributes: nodeModulesDir, directory, url for ( var i = 0 ; i < argv [ urlsKey ] . length ; i ++ ) { var configItem = { } ; configItem [ confUrlsKey ] = argv [ urlsKey ] [ i ] ; configItem [ confDownloadDirsKey ] = argv [ downloadDirsKey ] [ i ] ; configItem [ confDestinationDir ] = argv [ destinationDir ] [ i ] ; unjarConfigFromArguments . push ( configItem ) ; } } return unjarConfigFromArguments ; }
Finds the configuration passed by command line arguments.

CLI args are limited, thus one have to pass the following CLI arguments:
--urls = list of urls to download the jars from
--download-dirs = names of the directories to put the jars into (uncompress jar into this directory)
--destination-dirs = names of the directories where the directory (download-dirs) will be

Example for usage with command line args:
<pre><code>
--urls http://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar
--download-dirs selenium-server-standalone
--destination-dirs=/data
--urls http://otherurl.com/file.jar
--download-dirs otherurl-directory
--destination-dirs=/tmp
</pre></code>

This would download the selenium server standalone 2.4.32.1 jar into /data/selenium-server-standalone/  and uncompress the jar there
and file.jar downloaded from http://otherurl.com/file.jar into /tmp/otherurl-directory/  and uncompress the jar there

Important: the order does matter (first urls argument matches to first download-dirs and destination-dirs etc.)
Finds the configuration passed by command line arguments .