Adds a CLI

This commit is contained in:
Nemo 2020-02-10 18:40:47 +05:30
parent 2d0bbaf4a9
commit 146ea58ad8
3 changed files with 11 additions and 1 deletions

7
cli.js Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env node
const generator = require('./index');
let ISBN = process.argv[2];
let filepath = process.argv[3];
generator.write(filepath, ISBN);

View File

@ -37,7 +37,7 @@ function _convert(data, pretty) {
module.exports = {
write: function(filepath, isbn) {
OL.lookup(isbn, function(err, data) {
fs.writeFileSync(filepath, _convert(data));
fs.writeFileSync(filepath, _convert(data, true));
});
},
_convert: _convert

View File

@ -20,5 +20,8 @@
},
"devDependencies": {
"jest": "^25.1.0"
},
"bin": {
"generate-epub-xml": "./cli.js"
}
}