From 170afa5651923679797b3ea10c3f8e9e867c2373 Mon Sep 17 00:00:00 2001 From: Gabriel Csapo Date: Tue, 9 Jan 2018 20:04:41 -0800 Subject: [PATCH] 0.2.1 - if the version is set, don't try to print the version in the parent directory --- CHANGELOG.md | 6 +++++- index.js | 15 +++++++++------ package.json | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5afbd37..2cb0e07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -# 0.2.0 (01/04/2017) +# 0.2.1 (01/09/2018) + +- if the version is set, don't try to print the version in the parent directory + +# 0.2.0 (01/04/2018) - augments command and flag objects into hashmaps for faster lookup than array traversal - condenses help and version logic by also making lookup via hashmap diff --git a/index.js b/index.js index 56d3a0b..bce5790 100644 --- a/index.js +++ b/index.js @@ -50,12 +50,15 @@ module.exports = function Woof(helpMessage, options={}) { program['version'] = true; // If the version is provided, just use that - if(version) process.stdout.write(`v${version}\n`); - // try to get the version from the current applications package.json - try { - process.stdout.write(`v${require(`${parentDir}/package.json`).version}\n`); - } catch(ex) { - process.stdout.write('v?\n'); + if(version) { + process.stdout.write(`v${version}\n`); + } else { + // try to get the version from the current applications package.json + try { + process.stdout.write(`v${require(`${parentDir}/package.json`).version}\n`); + } catch(ex) { + process.stdout.write('v?\n'); + } } } diff --git a/package.json b/package.json index cad6392..392c382 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woof", - "version": "0.2.0", + "version": "0.2.1", "description": "🐶 command line applications made as easy as fetch", "main": "index.js", "scripts": {