Merge branch 'master' into check-updates
This commit is contained in:
3
parity/cli/config.invalid3.toml
Normal file
3
parity/cli/config.invalid3.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[signer]
|
||||
passwd = []
|
||||
|
||||
@@ -26,6 +26,8 @@ usage! {
|
||||
cmd_new: bool,
|
||||
cmd_list: bool,
|
||||
cmd_export: bool,
|
||||
cmd_blocks: bool,
|
||||
cmd_state: bool,
|
||||
cmd_import: bool,
|
||||
cmd_signer: bool,
|
||||
cmd_new_token: bool,
|
||||
@@ -249,6 +251,10 @@ usage! {
|
||||
flag_to: String = "latest", or |_| None,
|
||||
flag_format: Option<String> = None, or |_| None,
|
||||
flag_no_seal_check: bool = false, or |_| None,
|
||||
flag_no_storage: bool = false, or |_| None,
|
||||
flag_no_code: bool = false, or |_| None,
|
||||
flag_min_balance: Option<String> = None, or |_| None,
|
||||
flag_max_balance: Option<String> = None, or |_| None,
|
||||
|
||||
// -- Snapshot Optons
|
||||
flag_at: String = "latest", or |_| None,
|
||||
@@ -490,6 +496,8 @@ mod tests {
|
||||
cmd_new: false,
|
||||
cmd_list: false,
|
||||
cmd_export: false,
|
||||
cmd_state: false,
|
||||
cmd_blocks: false,
|
||||
cmd_import: false,
|
||||
cmd_signer: false,
|
||||
cmd_new_token: false,
|
||||
@@ -609,6 +617,10 @@ mod tests {
|
||||
flag_to: "latest".into(),
|
||||
flag_format: None,
|
||||
flag_no_seal_check: false,
|
||||
flag_no_code: false,
|
||||
flag_no_storage: false,
|
||||
flag_min_balance: None,
|
||||
flag_max_balance: None,
|
||||
|
||||
// -- Snapshot Optons
|
||||
flag_at: "latest".into(),
|
||||
@@ -658,11 +670,12 @@ mod tests {
|
||||
fn should_parse_config_and_return_errors() {
|
||||
let config1 = Args::parse_config(include_str!("./config.invalid1.toml"));
|
||||
let config2 = Args::parse_config(include_str!("./config.invalid2.toml"));
|
||||
let config3 = Args::parse_config(include_str!("./config.invalid3.toml"));
|
||||
|
||||
match (config1, config2) {
|
||||
(Err(ArgsError::Parsing(_)), Err(ArgsError::Decode(_))) => {},
|
||||
(a, b) => {
|
||||
assert!(false, "Got invalid error types: {:?}, {:?}", a, b);
|
||||
match (config1, config2, config3) {
|
||||
(Err(ArgsError::Parsing(_)), Err(ArgsError::Decode(_)), Err(ArgsError::UnknownFields(_))) => {},
|
||||
(a, b, c) => {
|
||||
assert!(false, "Got invalid error types: {:?}, {:?}, {:?}", a, b, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ macro_rules! usage {
|
||||
Parsing(Vec<toml::ParserError>),
|
||||
Decode(toml::DecodeError),
|
||||
Config(String, io::Error),
|
||||
UnknownFields(String),
|
||||
}
|
||||
|
||||
impl ArgsError {
|
||||
@@ -80,6 +81,11 @@ macro_rules! usage {
|
||||
println_stderr!("There was an error reading your config file at: {}", path);
|
||||
println_stderr!("{}", e);
|
||||
process::exit(2)
|
||||
},
|
||||
ArgsError::UnknownFields(fields) => {
|
||||
println_stderr!("You have some extra fields in your config file:");
|
||||
println_stderr!("{}", fields);
|
||||
process::exit(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,10 +179,13 @@ macro_rules! usage {
|
||||
let mut value_parser = toml::Parser::new(&config);
|
||||
match value_parser.parse() {
|
||||
Some(value) => {
|
||||
let result = rustc_serialize::Decodable::decode(&mut toml::Decoder::new(toml::Value::Table(value)));
|
||||
match result {
|
||||
Ok(config) => Ok(config),
|
||||
Err(e) => Err(e.into()),
|
||||
let mut decoder = toml::Decoder::new(toml::Value::Table(value));
|
||||
let result = rustc_serialize::Decodable::decode(&mut decoder);
|
||||
|
||||
match (result, decoder.toml) {
|
||||
(Err(e), _) => Err(e.into()),
|
||||
(_, Some(toml)) => Err(ArgsError::UnknownFields(toml::encode_str(&toml))),
|
||||
(Ok(config), None) => Ok(config),
|
||||
}
|
||||
},
|
||||
None => Err(ArgsError::Parsing(value_parser.errors)),
|
||||
|
||||
@@ -10,7 +10,7 @@ Usage:
|
||||
parity account import <path>... [options]
|
||||
parity wallet import <path> --password FILE [options]
|
||||
parity import [ <file> ] [options]
|
||||
parity export [ <file> ] [options]
|
||||
parity export (blocks | state) [ <file> ] [options]
|
||||
parity signer new-token [options]
|
||||
parity snapshot <file> [options]
|
||||
parity restore [ <file> ] [options]
|
||||
@@ -284,6 +284,16 @@ Import/Export Options:
|
||||
one of 'hex' and 'binary'.
|
||||
(default: {flag_format:?} = Import: auto, Export: binary)
|
||||
--no-seal-check Skip block seal check. (default: {flag_no_seal_check})
|
||||
--at BLOCK Export state at the given block, which may be an
|
||||
index, hash, or 'latest'. Note that taking snapshots at
|
||||
non-recent blocks will only work with --pruning archive
|
||||
(default: {flag_at})
|
||||
--no-storage Don't export account storge. (default: {flag_no_storage})
|
||||
--no-code Don't export account code. (default: {flag_no_code})
|
||||
--min-balance WEI Don't export accounts with balance less than specified.
|
||||
(default: {flag_min_balance:?})
|
||||
--max-balance WEI Don't export accounts with balance greater than specified.
|
||||
(default: {flag_max_balance:?})
|
||||
|
||||
Snapshot Options:
|
||||
--at BLOCK Take a snapshot at the given block, which may be an
|
||||
|
||||
Reference in New Issue
Block a user