Merge pull request #363 from poanetwork/afck-consensus-node

Fix consensus-node --help.
This commit is contained in:
Vladimir Komendantskiy 2018-12-12 09:25:31 +00:00 committed by GitHub
commit 3a0e512798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ mod network;
use std::collections::HashSet;
use std::net::SocketAddr;
use std::process;
use std::vec::Vec;
use docopt::Docopt;
@ -17,7 +18,7 @@ Consensus node example
Usage:
consensus-node --bind-address=<host:port> [--value=VALUE] [--remote-address=<host:port>]...
consensus-node (--help | -h)
consensus-node --help | -h
consensus-node --version
";
@ -34,6 +35,10 @@ fn parse_args() -> Args {
.version(Some(VERSION.to_owned()))
.parse()
.unwrap_or_else(|e| e.exit());
if args.get_count("-h") > 0 || args.get_count("--help") > 0 {
print!("{}", USAGE);
process::exit(0);
}
Args {
value: if args.get_count("--value") > 0 {
Some(args.get_str("--value").as_bytes().to_vec())