Skip to content

Commit

Permalink
bin: add --version and --help args. fixes bcoin-org#209.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed May 12, 2017
1 parent 993a275 commit b66f023
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bin/node
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit b66f023

Please sign in to comment.