blob: 4aa453ed6c3e1d44477b706b5be6f44d8780e48c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
mod account;
mod cmd;
mod hash;
mod hdk;
mod mnemonic;
mod rand;
mod transaction;
use crate::cmd::*;
use std::process;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(
name = "hdwallet",
about = "Hierarchical deterministic wallet for Ethereum"
)]
enum Options {
#[structopt(about = "Print account public address")]
Address(address::Options),
#[structopt(about = "Export a private key")]
Export(export::Options),
#[structopt(about = "Generate a new HD wallet mnemonic")]
New(new::Options),
#[structopt(about = "Sign a message")]
Sign(sign::Options),
}
fn main() {
if let Err(err) = match Options::from_args() {
Options::Address(options) => address::run(options),
Options::Export(options) => export::run(options),
Options::New(options) => new::run(options),
Options::Sign(options) => sign::run(options),
} {
if cfg!(debug_assertions) {
eprintln!("ERROR: {:?}", err);
} else {
eprintln!("ERROR: {}", err);
}
process::exit(-1);
}
}
|