Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions bin/bcoin-cli
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ class CLI {
}

async open() {

let print_usage = (err) => {
this.log(err);
this.log('Commands:');
this.log(' $ info: Get server info.');
this.log(' $ broadcast [tx-hex]: Broadcast transaction.');
this.log(' $ mempool: Get mempool snapshot.');
this.log(' $ tx [hash/address]: View transactions.');
this.log(' $ coin [hash+index/address]: View coins.');
this.log(' $ block [hash/height]: View block.');
this.log(' $ reset [height/hash]: Reset chain to desired block.');
this.log(' $ rpc [command] [args]: Execute RPC command.' +
' (`bcoin-cli rpc help` for more)');
}

switch (this.argv.shift()) {
case 'info':
await this.getInfo();
Expand All @@ -192,20 +207,14 @@ class CLI {
await this.reset();
break;
case 'rpc':
if (!this.argv.length) {
print_usage('Missing arguments');
break;
}
await this.rpc();
break;
default:
this.log('Unrecognized command.');
this.log('Commands:');
this.log(' $ info: Get server info.');
this.log(' $ broadcast [tx-hex]: Broadcast transaction.');
this.log(' $ mempool: Get mempool snapshot.');
this.log(' $ tx [hash/address]: View transactions.');
this.log(' $ coin [hash+index/address]: View coins.');
this.log(' $ block [hash/height]: View block.');
this.log(' $ reset [height/hash]: Reset chain to desired block.');
this.log(' $ rpc [command] [args]: Execute RPC command.' +
' (`bcoin-cli rpc help` for more)');
print_usage('Unrecognized command.');
break;
}
}
Expand Down