aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: b390021ebdfb7fe43b011824e085d3bd86874162 (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
mod account;
mod cmd;
mod hash;
mod hdk;
mod mnemonic;
mod rand;

use crate::cmd::*;
use std::process;
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[structopt(
    name = "hdwallet",
    about = "Hierarchical deterministic wallet for Ethereum"
)]
enum Options {
    Address(address::Options),
    Export(export::Options),
    New(new::Options),
    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);
    }
}