diff --git a/index.js b/index.js index f09d1cd..cc3fae6 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,7 @@ Options: --help Print help -o --output OUTPUT_FILE Output to OUTPUT_FILE -p --properties PROP1,[PROP2,...] Output specific properties of the parsed article + -V --version Print version The --properties option accepts a comma-separated list of values (with no spaces in-between). Suitable values are: html-title Outputs the article's title, wrapped in an

tag. @@ -50,10 +51,11 @@ Default value is "html-title,html-content"`); const stringArgParams = ['_', '--', "output", "properties"]; -const boolArgParams = ["help"]; +const boolArgParams = ["help", "version"]; const alias = { "output": 'o', - "properties": 'p' + "properties": 'p', + "version": 'V' } let args = parseArgs(process.argv.slice(2), { @@ -90,8 +92,14 @@ if (errored) { if (args.help) { printUsage(); return; +} else if (args.version) { + console.log(`readability-cli v${require("./package.json").version}`); + console.log(`Node.js ${process.version}`); + return; } + + let inputArg; const inputCount = args['_'].length + args['--'].length; if (inputCount > 1) {