Adds a CLI
parent
2d0bbaf4a9
commit
146ea58ad8
|
@ -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);
|
2
index.js
2
index.js
|
@ -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
|
||||
|
|
|
@ -20,5 +20,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"jest": "^25.1.0"
|
||||
},
|
||||
"bin": {
|
||||
"generate-epub-xml": "./cli.js"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue