Merge remote-tracking branch 'origin/master' into check-updates
This commit is contained in:
@@ -32,6 +32,8 @@ usage! {
|
||||
cmd_import: bool,
|
||||
cmd_signer: bool,
|
||||
cmd_new_token: bool,
|
||||
cmd_sign: bool,
|
||||
cmd_reject: bool,
|
||||
cmd_snapshot: bool,
|
||||
cmd_restore: bool,
|
||||
cmd_ui: bool,
|
||||
@@ -44,6 +46,7 @@ usage! {
|
||||
arg_pid_file: String,
|
||||
arg_file: Option<String>,
|
||||
arg_path: Vec<String>,
|
||||
arg_id: Option<usize>,
|
||||
|
||||
// Flags
|
||||
// -- Legacy Options
|
||||
@@ -515,6 +518,8 @@ mod tests {
|
||||
cmd_blocks: false,
|
||||
cmd_import: false,
|
||||
cmd_signer: false,
|
||||
cmd_sign: false,
|
||||
cmd_reject: false,
|
||||
cmd_new_token: false,
|
||||
cmd_snapshot: false,
|
||||
cmd_restore: false,
|
||||
@@ -527,6 +532,7 @@ mod tests {
|
||||
// Arguments
|
||||
arg_pid_file: "".into(),
|
||||
arg_file: None,
|
||||
arg_id: None,
|
||||
arg_path: vec![],
|
||||
|
||||
// -- Operating Options
|
||||
|
||||
@@ -12,6 +12,9 @@ Usage:
|
||||
parity import [ <file> ] [options]
|
||||
parity export (blocks | state) [ <file> ] [options]
|
||||
parity signer new-token [options]
|
||||
parity signer list [options]
|
||||
parity signer sign [ <id> ] [ --password FILE ] [options]
|
||||
parity signer reject <id> [options]
|
||||
parity snapshot <file> [options]
|
||||
parity restore [ <file> ] [options]
|
||||
parity tools hash <file>
|
||||
|
||||
@@ -44,6 +44,8 @@ use presale::ImportWallet;
|
||||
use account::{AccountCmd, NewAccount, ListAccounts, ImportAccounts, ImportFromGethAccounts};
|
||||
use snapshot::{self, SnapshotCommand};
|
||||
|
||||
const AUTHCODE_FILENAME: &'static str = "authcodes";
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Cmd {
|
||||
Run(RunCmd),
|
||||
@@ -52,6 +54,21 @@ pub enum Cmd {
|
||||
ImportPresaleWallet(ImportWallet),
|
||||
Blockchain(BlockchainCmd),
|
||||
SignerToken(SignerConfiguration),
|
||||
SignerSign {
|
||||
id: Option<usize>,
|
||||
pwfile: Option<PathBuf>,
|
||||
port: u16,
|
||||
authfile: PathBuf,
|
||||
},
|
||||
SignerList {
|
||||
port: u16,
|
||||
authfile: PathBuf
|
||||
},
|
||||
SignerReject {
|
||||
id: Option<usize>,
|
||||
port: u16,
|
||||
authfile: PathBuf
|
||||
},
|
||||
Snapshot(SnapshotCommand),
|
||||
Hash(Option<String>),
|
||||
}
|
||||
@@ -105,8 +122,36 @@ impl Configuration {
|
||||
|
||||
let cmd = if self.args.flag_version {
|
||||
Cmd::Version
|
||||
} else if self.args.cmd_signer && self.args.cmd_new_token {
|
||||
Cmd::SignerToken(signer_conf)
|
||||
} else if self.args.cmd_signer {
|
||||
let mut authfile = PathBuf::from(signer_conf.signer_path.clone());
|
||||
authfile.push(AUTHCODE_FILENAME);
|
||||
|
||||
if self.args.cmd_new_token {
|
||||
Cmd::SignerToken(signer_conf)
|
||||
} else if self.args.cmd_sign {
|
||||
let pwfile = self.args.flag_password.get(0).map(|pwfile| {
|
||||
PathBuf::from(pwfile)
|
||||
});
|
||||
Cmd::SignerSign {
|
||||
id: self.args.arg_id,
|
||||
pwfile: pwfile,
|
||||
port: signer_conf.port,
|
||||
authfile: authfile,
|
||||
}
|
||||
} else if self.args.cmd_reject {
|
||||
Cmd::SignerReject {
|
||||
id: self.args.arg_id,
|
||||
port: signer_conf.port,
|
||||
authfile: authfile,
|
||||
}
|
||||
} else if self.args.cmd_list {
|
||||
Cmd::SignerList {
|
||||
port: signer_conf.port,
|
||||
authfile: authfile,
|
||||
}
|
||||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
} else if self.args.cmd_tools && self.args.cmd_hash {
|
||||
Cmd::Hash(self.args.arg_file)
|
||||
} else if self.args.cmd_db && self.args.cmd_kill {
|
||||
@@ -1176,4 +1221,3 @@ mod tests {
|
||||
assert!(conf.init_reserved_nodes().is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,8 @@ extern crate ethcore_stratum;
|
||||
#[cfg(feature = "dapps")]
|
||||
extern crate ethcore_dapps;
|
||||
|
||||
extern crate rpc_cli;
|
||||
|
||||
macro_rules! dependency {
|
||||
($dep_ty:ident, $url:expr) => {
|
||||
{
|
||||
@@ -155,6 +157,9 @@ fn execute(command: Execute, can_restart: bool) -> Result<PostExecutionAction, S
|
||||
Cmd::ImportPresaleWallet(presale_cmd) => presale::execute(presale_cmd).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::Blockchain(blockchain_cmd) => blockchain::execute(blockchain_cmd).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::SignerToken(signer_cmd) => signer::execute(signer_cmd).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::SignerSign { id, pwfile, port, authfile } => rpc_cli::signer_sign(id, pwfile, port, authfile).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::SignerList { port, authfile } => rpc_cli::signer_list(port, authfile).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::SignerReject { id, port, authfile } => rpc_cli::signer_reject(id, port, authfile).map(|s| PostExecutionAction::Print(s)),
|
||||
Cmd::Snapshot(snapshot_cmd) => snapshot::execute(snapshot_cmd).map(|s| PostExecutionAction::Print(s)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user