Adds a CLI
This commit is contained in:
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 = {
|
module.exports = {
|
||||||
write: function(filepath, isbn) {
|
write: function(filepath, isbn) {
|
||||||
OL.lookup(isbn, function(err, data) {
|
OL.lookup(isbn, function(err, data) {
|
||||||
fs.writeFileSync(filepath, _convert(data));
|
fs.writeFileSync(filepath, _convert(data, true));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_convert: _convert
|
_convert: _convert
|
||||||
|
|
|
@ -20,5 +20,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^25.1.0"
|
"jest": "^25.1.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"generate-epub-xml": "./cli.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue