Comparing version
#!/usr/bin/env node | ||
var fs = require('fs'); | ||
var program = require('commander'); | ||
var eml = require('eml'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const program = require('commander'); | ||
const glob = require('glob'); | ||
const eml = require('eml'); | ||
@@ -10,8 +12,15 @@ program | ||
.option('-i, --input <file ...>', 'Input EML file') | ||
.option('-o, --output <file ...>', 'Output HTML file') | ||
.option('-o, --output [file ...]', 'Output HTML file') | ||
.parse(process.argv); | ||
const emlFile = fs.readFileSync(program.input, 'utf8'); | ||
const html = eml(emlFile); | ||
glob(program.input, null, function(err, paths) { | ||
paths.forEach(function(filePath) { | ||
const extension = path.extname(filePath); | ||
const dirname = path.dirname(filePath); | ||
const basename = path.basename(filePath, extension); | ||
const emlFile = fs.readFileSync(filePath, 'utf8'); | ||
const html = eml(emlFile); | ||
fs.writeFileSync(program.output, html, 'utf8'); | ||
fs.writeFileSync(dirname + '/' + basename + '.html', html, 'utf8'); | ||
}); | ||
}); |
{ | ||
"name": "eml-cli", | ||
"version": "0.0.109", | ||
"version": "0.0.110", | ||
"author": "Vlad Trushin", | ||
@@ -17,4 +17,5 @@ "description": "EML core", | ||
"commander": "^2.14.1", | ||
"eml": "0.0.110" | ||
"eml": "0.0.110", | ||
"glob": "^7.1.2" | ||
} | ||
} |
1223
46.29%21
90.91%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added