226fe8e0bb
* cli commands * cleanup parity/signer * cleanup parity/signer * remove redundant import of signer crate from main.rs * cli cleanup in progress * cli cleanup in progress * moved few commonly used functions to separate methods with tests * cleaning up blockchain import in progress * cleaning up blockchain import in progress2 * cleaning up blockchain import in progress3 * tests for database compaction profile parsing * cleaning up blockchain import in progress4 * cleaning up blockchain import in progress5 * blockchain import * export blockchain in progress * cleanup execute_export * Configuration::to_duration cleaned up * removed unused code, tests for to_duration * cleanup Configuration::mode function * parsing some of the cli params in params.rs * rpc and signer are no longer optional * move importing extern crates to main.rs file * swipe dies from rpc module * swipe dies from dapps * finding deprecated * several tests and fixes for parity * parity cleanup in progress * cleanup price parsing * parity cleanup in progress * swiped all dies * parity cleanup in progress * replace usages of from_str with parse() in parity/params.rs * removed few more from_str * split parity/params.rs into params and helpers * removed wildcard import from configuration.rs * cleanup directories/path creation * cleaning up run cmd * moved LoggerConfig * defaults for cli params * fixed indention in raise_fd_limit * tests for rpc_apis * tests for default ipc and rpc settings * ipc socket * cleanup in progress * account service * cleanup miner config * BlockChain commands use Directiores structure now * client_config * network settings and dapps configuration * removing warnings * default logger config * fixed client_path * overhaul * fixing export && import * default export DataFormat * import and export also upgrade db * fixed export && import * polishing pr * polishing pr * fixed custom bootnodes * fixed daemonize on windows * fixed setting up enable network * finished pr * fixed compiling on windows * Fixed warning; windows build * Better cache management * Fixed tests on windows * Fixed test * Restored pruning method names * --cache alias * Fixed more tests * Ensure default options actually listed as valid [ci:skip]
125 lines
3.0 KiB
Rust
125 lines
3.0 KiB
Rust
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
|
// This file is part of Parity.
|
|
|
|
// Parity is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Parity is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Ethcore client application.
|
|
|
|
#![warn(missing_docs)]
|
|
#![cfg_attr(feature="dev", feature(plugin))]
|
|
#![cfg_attr(feature="dev", plugin(clippy))]
|
|
#![cfg_attr(feature="dev", allow(useless_format))]
|
|
#![cfg_attr(feature="dev", allow(match_bool))]
|
|
|
|
extern crate docopt;
|
|
extern crate num_cpus;
|
|
extern crate rustc_serialize;
|
|
extern crate ethcore_util as util;
|
|
extern crate ethcore;
|
|
extern crate ethsync;
|
|
#[macro_use]
|
|
extern crate log as rlog;
|
|
extern crate env_logger;
|
|
extern crate ethcore_logger;
|
|
extern crate ctrlc;
|
|
extern crate fdlimit;
|
|
extern crate time;
|
|
extern crate number_prefix;
|
|
extern crate rpassword;
|
|
extern crate semver;
|
|
extern crate ethcore_ipc as ipc;
|
|
extern crate ethcore_ipc_nano as nanoipc;
|
|
#[macro_use]
|
|
extern crate hyper; // for price_info.rs
|
|
extern crate json_ipc_server as jsonipc;
|
|
|
|
extern crate ethcore_ipc_hypervisor as hypervisor;
|
|
extern crate ethcore_rpc;
|
|
|
|
extern crate ethcore_signer;
|
|
extern crate ansi_term;
|
|
#[macro_use]
|
|
extern crate lazy_static;
|
|
extern crate regex;
|
|
extern crate isatty;
|
|
|
|
#[cfg(feature = "dapps")]
|
|
extern crate ethcore_dapps;
|
|
|
|
mod cache;
|
|
mod upgrade;
|
|
mod rpc;
|
|
mod dapps;
|
|
mod informant;
|
|
mod io_handler;
|
|
mod cli;
|
|
mod configuration;
|
|
mod migration;
|
|
mod signer;
|
|
mod rpc_apis;
|
|
mod url;
|
|
mod helpers;
|
|
mod params;
|
|
mod deprecated;
|
|
mod dir;
|
|
mod modules;
|
|
mod account;
|
|
mod blockchain;
|
|
mod presale;
|
|
mod run;
|
|
|
|
use std::{process, env};
|
|
use cli::print_version;
|
|
use configuration::{Cmd, Configuration};
|
|
use deprecated::find_deprecated;
|
|
|
|
fn execute(command: Cmd) -> Result<String, String> {
|
|
match command {
|
|
Cmd::Run(run_cmd) => {
|
|
try!(run::execute(run_cmd));
|
|
Ok("".into())
|
|
},
|
|
Cmd::Version => Ok(print_version()),
|
|
Cmd::Account(account_cmd) => account::execute(account_cmd),
|
|
Cmd::ImportPresaleWallet(presale_cmd) => presale::execute(presale_cmd),
|
|
Cmd::Blockchain(blockchain_cmd) => blockchain::execute(blockchain_cmd),
|
|
Cmd::SignerToken(path) => signer::new_token(path),
|
|
}
|
|
}
|
|
|
|
fn start() -> Result<String, String> {
|
|
let conf = Configuration::parse(env::args()).unwrap_or_else(|e| e.exit());
|
|
|
|
let deprecated = find_deprecated(&conf.args);
|
|
for d in deprecated {
|
|
println!("{}", d);
|
|
}
|
|
|
|
let cmd = try!(conf.into_command());
|
|
execute(cmd)
|
|
}
|
|
|
|
fn main() {
|
|
match start() {
|
|
Ok(result) => {
|
|
print!("{}", result);
|
|
},
|
|
Err(err) => {
|
|
print!("{}", err);
|
|
process::exit(1);
|
|
}
|
|
}
|
|
}
|
|
|