Skip to content

Commit

Permalink
Merge pull request asciidoctor#39 from Mogztter/issue-37-version
Browse files Browse the repository at this point in the history
Resolves asciidoctor#37, add the CLI version and the Asciidoctor.js version
  • Loading branch information
ggrossetie authored Dec 1, 2018
2 parents da1df39 + e6bb4e0 commit d3eace9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const yargs = require('yargs')
const asciidoctor = require('asciidoctor.js')()
const pkg = require('../package.json')

function convertOptions (argv) {
const backend = argv['backend']
Expand Down Expand Up @@ -180,6 +181,7 @@ function argsParser () {
type: 'boolean'
})
})
.version(false)
.help()
}

Expand All @@ -189,9 +191,10 @@ function run (argv) {
const files = argv['files']
const options = convertOptions(argv)
if (version || (verbose && files && files.length === 0)) {
console.log(`Asciidoctor ${asciidoctor.getCoreVersion()} [http://asciidoctor.org]`)
console.log(`Asciidoctor.js ${asciidoctor.getVersion()} [https://asciidoctor.org]`)
const releaseName = process.release ? process.release.name : 'node'
console.log(`Runtime Environment (${releaseName} ${process.version} on ${process.platform})`)
console.log(`CLI version ${pkg.version}`)
} else if (files && files.length > 0) {
files.forEach(function (file) {
if (verbose) {
Expand Down

0 comments on commit d3eace9

Please sign in to comment.