poa-bridge/src/main.rs

63 lines
1.1 KiB
Rust
Raw Normal View History

2017-06-25 04:21:13 -07:00
#[macro_use]
extern crate futures;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate toml;
extern crate web3;
extern crate docopt;
mod config;
mod data;
mod error;
use std::env;
use std::path::PathBuf;
use docopt::Docopt;
use config::Config;
use error::Error;
const USAGE: &'static str = r#"
Ethereum-Kovan bridge.
Copyright 2017 Parity Technologies (UK) Limited
Usage:
bridge --config <config> --database <database>
bridge -h | --help
Options:
-h, --help Display help message and exit.
"#;
#[derive(Debug, Deserialize)]
pub struct Args {
arg_config: Option<PathBuf>,
arg_database: PathBuf,
}
fn main() {
let result = execute(env::args());
match result {
Ok(s) => println!("{}", s),
Err(err) => println!("{}", err),
}
}
fn execute<S, I>(command: I) -> Result<String, Error> where I: IntoIterator<Item=S>, S: AsRef<str> {
let args: Args = Docopt::new(USAGE)
.and_then(|d| d.argv(command).deserialize())?;
let config = match args.arg_config {
Some(path) => Config::load(path)?,
None => Config::default(),
};
Ok("Done".into())
}
#[cfg(test)]
mod tests {
}