Require outputfile command line argument, display usage info if missing, and always make relative to script location

このコミットが含まれているのは:
Greg MacLellan 2014-06-16 14:21:06 -04:00
コミット ecaf4e4eab
1個のファイルの変更8行の追加4行の削除

ファイルの表示

@ -147,12 +147,16 @@ function dumpCerts(certs, filename) {
console.info("Wrote '" + filename.replace(/'/g, "\\'") + "'.");
}
//Expects a filename as the second command line argument
var outputFile = process.argv[2];
if(outputFile == null) {
outputFile = path.join(__dirname, 'ssl-root-cas-latest.js');
if (process.argv[2] == null) {
console.error("Error: No file specified");
console.info("Usage: %s <outputfile>", process.argv[1]);
console.info(" where <outputfile> is the name of the file to write to, relative to %s", process.argv[1]);
process.exit(3);
}
//Expects a filename as the second command line argument; made relative to directory of this file
var outputFile = path.resolve(__dirname, process.argv[2]);
console.info("Loading latest certificates from " + CERTDB_URL);
request(CERTDB_URL, function (error, response, body) {
if (error) {