From b66f023e2281981335d5a4e766912548b978a820 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 12 May 2017 11:44:08 -0700 Subject: [PATCH] bin: add --version and --help args. fixes #209. --- bin/node | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/node b/bin/node index f5627261..b52dc67e 100755 --- a/bin/node +++ b/bin/node @@ -4,6 +4,21 @@ process.title = 'bcoin'; +if (process.argv.indexOf('--help') !== -1 + || process.argv.indexOf('-h') !== -1) { + console.error('See the bcoin wiki at: https://github.com/bcoin-org/bcoin/wiki.'); + process.exit(1); + throw new Error('Could not exit.'); +} + +if (process.argv.indexOf('--version') !== -1 + || process.argv.indexOf('-v') !== -1) { + var pkg = require('../package.json'); + console.log(pkg.version); + process.exit(0); + throw new Error('Could not exit.'); +} + var bcoin = require('../'); var plugin = require('../lib/wallet/plugin'); var co = bcoin.co; @@ -23,7 +38,7 @@ node = new bcoin.fullnode({ }); // Temporary hack -if (!node.has('walletdb')) +if (!node.config.bool('no-wallet') && !node.has('walletdb')) node.use(plugin); node.on('error', function(err) {