rfc-to-bib
Version:
A library and CLI tool to generate BibTeX records for IETF RFCs.
41 lines (32 loc) • 745 B
JavaScript
;
const rfcToBib = require('../lib');
const logError = require('../lib/log-error');
const meow = require('meow');
const EXIT_FAILURE = 1;
const RADIX = 10;
let rfc = Number.parseInt(process.argv[2], RADIX);
const cli = meow(`
Usage
$ rfc-to-bib <rfc>
Options
-h, --help Display this screen.
-v, --version Display the software version.
Examples
$ rfc-to-bib 2616
$ rfc-to-bib 2616 > rfc2616.bib
`, {
alias: {
h: 'help',
v: 'version'
}
});
if (Number.isNaN(rfc)) {
cli.showHelp();
}
rfcToBib(rfc).then(bib => {
console.log(bib);
}).catch(error => {
logError(error.message);
process.exit(EXIT_FAILURE);
});