* Refactor and port CLI from Docopt to Clap (#2066) * Add --can-restart and --force-direct to help * Add flag support to subc & move import/export options to subcommand * Reorder subcommand args (put positional args last in CLI help message)
This commit is contained in:
1662
parity/cli/mod.rs
1662
parity/cli/mod.rs
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ macro_rules! println_stderr(
|
||||
);
|
||||
|
||||
macro_rules! otry {
|
||||
($e: expr) => (
|
||||
($e:expr) => (
|
||||
match $e {
|
||||
Some(ref v) => v,
|
||||
None => {
|
||||
@@ -31,21 +31,107 @@ macro_rules! otry {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! if_option {
|
||||
(Option<$type:ty>, THEN {$($then:tt)*} ELSE {$($otherwise:tt)*}) => (
|
||||
$($then)*
|
||||
);
|
||||
($type:ty, THEN {$($then:tt)*} ELSE {$($otherwise:tt)*}) => (
|
||||
$($otherwise)*
|
||||
);
|
||||
}
|
||||
|
||||
macro_rules! if_vec {
|
||||
(Vec<$type:ty>, THEN {$($then:tt)*} ELSE {$($otherwise:tt)*}) => (
|
||||
$($then)*
|
||||
);
|
||||
($type:ty, THEN {$($then:tt)*} ELSE {$($otherwise:tt)*}) => (
|
||||
$($otherwise)*
|
||||
);
|
||||
}
|
||||
|
||||
macro_rules! if_option_vec {
|
||||
(Option<Vec<String>>, THEN {$then:expr} ELSE {$otherwise:expr}) => (
|
||||
$then
|
||||
);
|
||||
(Option<$type:ty>, THEN {$then:expr} ELSE {$otherwise:expr}) => (
|
||||
$otherwise
|
||||
);
|
||||
}
|
||||
|
||||
macro_rules! inner_option_type {
|
||||
(Option<$type:ty>) => (
|
||||
$type
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! inner_vec_type {
|
||||
(Vec<$type:ty>) => (
|
||||
$type
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! inner_option_vec_type {
|
||||
(Option<Vec<String>>) => (
|
||||
String
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! usage_with_ident {
|
||||
($name:expr, $usage:expr, $help:expr) => (
|
||||
if $usage.contains("<") {
|
||||
format!("<{}> {} '{}'",$name, $usage, $help)
|
||||
} else {
|
||||
format!("[{}] {} '{}'",$name, $usage, $help)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
macro_rules! underscore_to_hyphen {
|
||||
($e:expr) => (
|
||||
str::replace($e, "_", "-")
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! usage {
|
||||
(
|
||||
{
|
||||
$(
|
||||
$field_a:ident : $typ_a:ty,
|
||||
CMD $subc:ident
|
||||
{
|
||||
$subc_help:expr,
|
||||
|
||||
$(
|
||||
CMD $subc_subc:ident
|
||||
{
|
||||
$subc_subc_help:expr,
|
||||
$(
|
||||
FLAG $subc_subc_flag:ident : (bool) = false, $subc_subc_flag_usage:expr, $subc_subc_flag_help:expr,
|
||||
)*
|
||||
$(
|
||||
ARG $subc_subc_arg:ident : ($($subc_subc_arg_type_tt:tt)+) = $subc_subc_arg_default:expr, $subc_subc_arg_usage:expr, $subc_subc_arg_help:expr,
|
||||
)*
|
||||
}
|
||||
)*
|
||||
|
||||
$(
|
||||
FLAG $subc_flag:ident : (bool) = false, $subc_flag_usage:expr, $subc_flag_help:expr,
|
||||
)*
|
||||
$(
|
||||
ARG $subc_arg:ident : ($($subc_arg_type_tt:tt)+) = $subc_arg_default:expr, $subc_arg_usage:expr, $subc_arg_help:expr,
|
||||
)*
|
||||
}
|
||||
)*
|
||||
}
|
||||
{
|
||||
$(
|
||||
$field:ident : $typ:ty = $default:expr, or $from_config:expr,
|
||||
)*
|
||||
}
|
||||
{
|
||||
$(
|
||||
$field_s:ident : $typ_s:ty, display $default_s:expr, or $from_config_s:expr,
|
||||
[$group_name:expr]
|
||||
$(
|
||||
FLAG $flag:ident : (bool) = false, or $flag_from_config:expr, $flag_usage:expr, $flag_help:expr,
|
||||
)*
|
||||
$(
|
||||
ARG $arg:ident : ($($arg_type_tt:tt)+) = $arg_default:expr, or $arg_from_config:expr, $arg_usage:expr, $arg_help:expr,
|
||||
)*
|
||||
)*
|
||||
}
|
||||
) => {
|
||||
@@ -53,12 +139,17 @@ macro_rules! usage {
|
||||
use std::{fs, io, process};
|
||||
use std::io::{Read, Write};
|
||||
use util::version;
|
||||
use docopt::{Docopt, Error as DocoptError};
|
||||
use clap::{Arg, App, SubCommand, AppSettings, Error as ClapError};
|
||||
use helpers::replace_home;
|
||||
use std::ffi::OsStr;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[cfg(test)]
|
||||
use regex::Regex;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ArgsError {
|
||||
Docopt(DocoptError),
|
||||
Clap(ClapError),
|
||||
Decode(toml::de::Error),
|
||||
Config(String, io::Error),
|
||||
}
|
||||
@@ -66,7 +157,7 @@ macro_rules! usage {
|
||||
impl ArgsError {
|
||||
pub fn exit(self) -> ! {
|
||||
match self {
|
||||
ArgsError::Docopt(e) => e.exit(),
|
||||
ArgsError::Clap(e) => e.exit(),
|
||||
ArgsError::Decode(e) => {
|
||||
println_stderr!("You might have supplied invalid parameters in config file.");
|
||||
println_stderr!("{}", e);
|
||||
@@ -81,9 +172,9 @@ macro_rules! usage {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DocoptError> for ArgsError {
|
||||
fn from(e: DocoptError) -> Self {
|
||||
ArgsError::Docopt(e)
|
||||
impl From<ClapError> for ArgsError {
|
||||
fn from(e: ClapError) -> Self {
|
||||
ArgsError::Clap(e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,15 +187,33 @@ macro_rules! usage {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Args {
|
||||
$(
|
||||
pub $field_a: $typ_a,
|
||||
pub $subc: bool,
|
||||
|
||||
$(
|
||||
pub $subc_subc: bool,
|
||||
$(
|
||||
pub $subc_subc_flag: bool,
|
||||
)*
|
||||
$(
|
||||
pub $subc_subc_arg: $($subc_subc_arg_type_tt)+,
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
pub $subc_flag: bool,
|
||||
)*
|
||||
$(
|
||||
pub $subc_arg: $($subc_arg_type_tt)+,
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
pub $field: $typ,
|
||||
)*
|
||||
|
||||
$(
|
||||
pub $field_s: $typ_s,
|
||||
$(
|
||||
pub $flag: bool,
|
||||
)*
|
||||
$(
|
||||
pub $arg: $($arg_type_tt)+,
|
||||
)*
|
||||
)*
|
||||
}
|
||||
|
||||
@@ -112,15 +221,32 @@ macro_rules! usage {
|
||||
fn default() -> Self {
|
||||
Args {
|
||||
$(
|
||||
$field_a: Default::default(),
|
||||
$subc: Default::default(),
|
||||
$(
|
||||
$subc_subc: Default::default(),
|
||||
$(
|
||||
$subc_subc_flag: Default::default(),
|
||||
)*
|
||||
$(
|
||||
$subc_subc_arg: Default::default(),
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
$subc_flag: Default::default(),
|
||||
)*
|
||||
$(
|
||||
$subc_arg: Default::default(),
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
$field: $default.into(),
|
||||
)*
|
||||
|
||||
$(
|
||||
$field_s: Default::default(),
|
||||
$(
|
||||
$flag: Default::default(),
|
||||
)*
|
||||
$(
|
||||
$arg: Default::default(),
|
||||
)*
|
||||
)*
|
||||
}
|
||||
}
|
||||
@@ -129,13 +255,46 @@ macro_rules! usage {
|
||||
#[derive(Default, Debug, PartialEq, Clone, Deserialize)]
|
||||
struct RawArgs {
|
||||
$(
|
||||
$field_a: $typ_a,
|
||||
$subc: bool,
|
||||
|
||||
$(
|
||||
$subc_subc: bool,
|
||||
$(
|
||||
$subc_subc_flag: bool,
|
||||
)*
|
||||
$(
|
||||
$subc_subc_arg: if_option!(
|
||||
$($subc_subc_arg_type_tt)+,
|
||||
THEN { $($subc_subc_arg_type_tt)+ }
|
||||
ELSE { Option<$($subc_subc_arg_type_tt)+> }
|
||||
),
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
$subc_flag: bool,
|
||||
)*
|
||||
$(
|
||||
$subc_arg: if_option!(
|
||||
$($subc_arg_type_tt)+,
|
||||
THEN { $($subc_arg_type_tt)+ }
|
||||
ELSE { Option<$($subc_arg_type_tt)+> }
|
||||
),
|
||||
)*
|
||||
|
||||
)*
|
||||
$(
|
||||
$field: Option<$typ>,
|
||||
)*
|
||||
$(
|
||||
$field_s: Option<$typ_s>,
|
||||
$(
|
||||
$flag: bool,
|
||||
)*
|
||||
|
||||
$(
|
||||
$arg: if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { $($arg_type_tt)+ }
|
||||
ELSE { Option<$($arg_type_tt)+> }
|
||||
),
|
||||
)*
|
||||
)*
|
||||
}
|
||||
|
||||
@@ -149,9 +308,9 @@ macro_rules! usage {
|
||||
return Ok(raw_args.into_args(Config::default()));
|
||||
}
|
||||
|
||||
let config_file = raw_args.flag_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).flag_config);
|
||||
let config_file = raw_args.arg_config.clone().unwrap_or_else(|| raw_args.clone().into_args(Config::default()).arg_config);
|
||||
let config_file = replace_home(&::dir::default_data_path(), &config_file);
|
||||
match (fs::File::open(&config_file), raw_args.flag_config.clone()) {
|
||||
match (fs::File::open(&config_file), raw_args.arg_config.clone()) {
|
||||
// Load config file
|
||||
(Ok(mut file), _) => {
|
||||
println_stderr!("Loading config file from {}", &config_file);
|
||||
@@ -178,7 +337,7 @@ macro_rules! usage {
|
||||
|
||||
#[cfg(test)]
|
||||
fn parse_with_config<S: AsRef<str>>(command: &[S], config: Config) -> Result<Self, ArgsError> {
|
||||
RawArgs::parse(command).map(|raw| raw.into_args(config)).map_err(ArgsError::Docopt)
|
||||
RawArgs::parse(command).map(|raw| raw.into_args(config)).map_err(ArgsError::Clap)
|
||||
}
|
||||
|
||||
fn parse_config(config: &str) -> Result<Config, ArgsError> {
|
||||
@@ -188,41 +347,346 @@ macro_rules! usage {
|
||||
pub fn print_version() -> String {
|
||||
format!(include_str!("./version.txt"), version())
|
||||
}
|
||||
|
||||
#[allow(unused_mut)] // subc_subc_exist may be assigned true by the macro
|
||||
#[allow(unused_assignments)] // Rust issue #22630
|
||||
pub fn print_help() -> String {
|
||||
let mut help : String = include_str!("./usage_header.txt").to_owned();
|
||||
|
||||
help.push_str("\n\n");
|
||||
|
||||
// Subcommands
|
||||
help.push_str("parity [options]\n");
|
||||
$(
|
||||
{
|
||||
let mut subc_subc_exist = false;
|
||||
|
||||
$(
|
||||
subc_subc_exist = true;
|
||||
let subc_subc_usages : Vec<&str> = vec![
|
||||
$(
|
||||
concat!("[",$subc_subc_flag_usage,"]"),
|
||||
)*
|
||||
$(
|
||||
$subc_subc_arg_usage,
|
||||
)*
|
||||
];
|
||||
|
||||
if subc_subc_usages.is_empty() {
|
||||
help.push_str(&format!("parity [options] {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..])));
|
||||
} else {
|
||||
help.push_str(&format!("parity [options] {} {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]), subc_subc_usages.join(" ")));
|
||||
}
|
||||
)*
|
||||
|
||||
// Print the subcommand on its own only if it has no subsubcommands
|
||||
if !subc_subc_exist {
|
||||
let subc_usages : Vec<&str> = vec![
|
||||
$(
|
||||
concat!("[",$subc_flag_usage,"]"),
|
||||
)*
|
||||
$(
|
||||
$subc_arg_usage,
|
||||
)*
|
||||
];
|
||||
|
||||
if subc_usages.is_empty() {
|
||||
help.push_str(&format!("parity [options] {}\n", underscore_to_hyphen!(&stringify!($subc)[4..])));
|
||||
} else {
|
||||
help.push_str(&format!("parity [options] {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), subc_usages.join(" ")));
|
||||
}
|
||||
}
|
||||
}
|
||||
)*
|
||||
|
||||
// Arguments and flags
|
||||
$(
|
||||
help.push_str("\n");
|
||||
help.push_str($group_name); help.push_str(":\n");
|
||||
|
||||
$(
|
||||
help.push_str(&format!("\t{}\n\t\t{}\n", $flag_usage, $flag_help));
|
||||
)*
|
||||
|
||||
$(
|
||||
if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {:?})\n", $arg_usage, $arg_help, {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x}))
|
||||
}
|
||||
ELSE {
|
||||
help.push_str(&format!("\t{}\n\t\t{}{}\n", $arg_usage, $arg_help, $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned())))
|
||||
}
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {:?})\n", $arg_usage, $arg_help, {let x : $($arg_type_tt)+ = $arg_default; x}))
|
||||
}
|
||||
ELSE {
|
||||
help.push_str(&format!("\t{}\n\t\t{} (default: {})\n", $arg_usage, $arg_help, $arg_default))
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
)*
|
||||
|
||||
)*
|
||||
|
||||
help
|
||||
}
|
||||
}
|
||||
|
||||
impl RawArgs {
|
||||
fn into_args(self, config: Config) -> Args {
|
||||
let mut args = Args::default();
|
||||
$(
|
||||
args.$field_a = self.$field_a;
|
||||
args.$subc = self.$subc;
|
||||
|
||||
$(
|
||||
args.$subc_subc = self.$subc_subc;
|
||||
$(
|
||||
args.$subc_subc_flag = self.$subc_subc_flag;
|
||||
)*
|
||||
$(
|
||||
args.$subc_subc_arg = if_option!(
|
||||
$($subc_subc_arg_type_tt)+,
|
||||
THEN { self.$subc_subc_arg.or($subc_subc_arg_default) }
|
||||
ELSE { self.$subc_subc_arg.unwrap_or($subc_subc_arg_default.into()) }
|
||||
);
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
args.$subc_flag = self.$subc_flag;
|
||||
)*
|
||||
$(
|
||||
args.$subc_arg = if_option!(
|
||||
$($subc_arg_type_tt)+,
|
||||
THEN { self.$subc_arg.or($subc_arg_default) }
|
||||
ELSE { self.$subc_arg.unwrap_or($subc_arg_default.into()) }
|
||||
);
|
||||
)*
|
||||
)*
|
||||
|
||||
$(
|
||||
args.$field = self.$field.or_else(|| $from_config(&config)).unwrap_or_else(|| $default.into());
|
||||
)*
|
||||
$(
|
||||
args.$field_s = self.$field_s.or_else(|| $from_config_s(&config)).unwrap_or(None);
|
||||
$(
|
||||
args.$flag = self.$flag || $flag_from_config(&config).unwrap_or(false);
|
||||
)*
|
||||
$(
|
||||
args.$arg = if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { self.$arg.or_else(|| $arg_from_config(&config)).or_else(|| $arg_default.into()) }
|
||||
ELSE { self.$arg.or_else(|| $arg_from_config(&config)).unwrap_or_else(|| $arg_default.into()) }
|
||||
);
|
||||
)*
|
||||
)*
|
||||
args
|
||||
}
|
||||
|
||||
pub fn parse<S: AsRef<str>>(command: &[S]) -> Result<Self, DocoptError> {
|
||||
Docopt::new(Self::usage()).and_then(|d| d.argv(command).deserialize())
|
||||
#[allow(unused_variables)] // the submatches of arg-less subcommands aren't used
|
||||
pub fn parse<S: AsRef<str>>(command: &[S]) -> Result<Self, ClapError> {
|
||||
|
||||
let usages = vec![
|
||||
$(
|
||||
$(
|
||||
usage_with_ident!(stringify!($arg), $arg_usage, $arg_help),
|
||||
)*
|
||||
$(
|
||||
usage_with_ident!(stringify!($flag), $flag_usage, $flag_help),
|
||||
)*
|
||||
)*
|
||||
];
|
||||
|
||||
// Hash of subc|subc_subc => Vec<String>
|
||||
let mut subc_usages = HashMap::new();
|
||||
$(
|
||||
{
|
||||
let this_subc_usages = vec![
|
||||
$(
|
||||
usage_with_ident!(stringify!($subc_flag), $subc_flag_usage, $subc_flag_help),
|
||||
)*
|
||||
$(
|
||||
usage_with_ident!(stringify!($subc_arg), $subc_arg_usage, $subc_arg_help),
|
||||
)*
|
||||
];
|
||||
|
||||
subc_usages.insert(stringify!($subc),this_subc_usages);
|
||||
|
||||
$(
|
||||
{
|
||||
let this_subc_subc_usages = vec![
|
||||
$(
|
||||
usage_with_ident!(stringify!($subc_subc_flag), $subc_subc_flag_usage, $subc_subc_flag_help),
|
||||
)*
|
||||
$(
|
||||
usage_with_ident!(stringify!($subc_subc_arg), $subc_subc_arg_usage, $subc_subc_arg_help),
|
||||
)*
|
||||
];
|
||||
|
||||
subc_usages.insert(stringify!($subc_subc), this_subc_subc_usages);
|
||||
}
|
||||
)*
|
||||
}
|
||||
)*
|
||||
|
||||
let matches = App::new("Parity")
|
||||
.global_setting(AppSettings::VersionlessSubcommands)
|
||||
.global_setting(AppSettings::AllowLeadingHyphen) // allow for example --allow-ips -10.0.0.0/8
|
||||
.global_setting(AppSettings::DisableHelpSubcommand)
|
||||
.help(Args::print_help().as_ref())
|
||||
.args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false)).collect::<Vec<Arg>>())
|
||||
$(
|
||||
.subcommand(
|
||||
SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc)[4..]))
|
||||
.about($subc_help)
|
||||
.args(&subc_usages.get(stringify!($subc)).unwrap().iter().map(|u| Arg::from_usage(u).use_delimiter(false)).collect::<Vec<Arg>>())
|
||||
$(
|
||||
.setting(AppSettings::SubcommandRequired) // prevent from running `parity account`
|
||||
.subcommand(
|
||||
SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]))
|
||||
.about($subc_subc_help)
|
||||
.args(&subc_usages.get(stringify!($subc_subc)).unwrap().iter().map(|u| Arg::from_usage(u).use_delimiter(false)).collect::<Vec<Arg>>())
|
||||
)
|
||||
)*
|
||||
)
|
||||
)*
|
||||
.get_matches_from_safe(command.iter().map(|x| OsStr::new(x.as_ref())))?;
|
||||
|
||||
let mut raw_args : RawArgs = Default::default();
|
||||
$(
|
||||
$(
|
||||
raw_args.$flag = matches.is_present(stringify!($flag));
|
||||
)*
|
||||
$(
|
||||
raw_args.$arg = if_option!(
|
||||
$($arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_option_vec_type!($($arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(matches, stringify!($arg), inner_option_type!($($arg_type_tt)+)).ok() }
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($arg_type_tt)+,
|
||||
THEN { values_t!(matches, stringify!($arg), inner_vec_type!($($arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(matches, stringify!($arg), $($arg_type_tt)+).ok() }
|
||||
)
|
||||
}
|
||||
);
|
||||
)*
|
||||
)*
|
||||
|
||||
// Subcommands
|
||||
$(
|
||||
if let Some(submatches) = matches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc)[4..])) {
|
||||
raw_args.$subc = true;
|
||||
|
||||
// Subcommand flags
|
||||
$(
|
||||
raw_args.$subc_flag = submatches.is_present(&stringify!($subc_flag));
|
||||
)*
|
||||
// Subcommand arguments
|
||||
$(
|
||||
raw_args.$subc_arg = if_option!(
|
||||
$($subc_arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($subc_arg_type_tt)+,
|
||||
THEN { values_t!(submatches, stringify!($subc_arg), inner_option_vec_type!($($subc_arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(submatches, stringify!($subc_arg), inner_option_type!($($subc_arg_type_tt)+)).ok() }
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($subc_arg_type_tt)+,
|
||||
THEN { values_t!(submatches, stringify!($subc_arg), inner_vec_type!($($subc_arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(submatches, stringify!($subc_arg), $($subc_arg_type_tt)+).ok() }
|
||||
)
|
||||
}
|
||||
);
|
||||
)*
|
||||
|
||||
// Sub-subcommands
|
||||
$(
|
||||
if let Some(subsubmatches) = submatches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..])) {
|
||||
raw_args.$subc_subc = true;
|
||||
|
||||
// Sub-subcommand flags
|
||||
$(
|
||||
raw_args.$subc_subc_flag = subsubmatches.is_present(&stringify!($subc_subc_flag));
|
||||
)*
|
||||
// Sub-subcommand arguments
|
||||
$(
|
||||
raw_args.$subc_subc_arg = if_option!(
|
||||
$($subc_subc_arg_type_tt)+,
|
||||
THEN {
|
||||
if_option_vec!(
|
||||
$($subc_subc_arg_type_tt)+,
|
||||
THEN { values_t!(subsubmatches, stringify!($subc_subc_arg), inner_option_vec_type!($($subc_subc_arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(subsubmatches, stringify!($subc_subc_arg), inner_option_type!($($subc_subc_arg_type_tt)+)).ok() }
|
||||
)
|
||||
}
|
||||
ELSE {
|
||||
if_vec!(
|
||||
$($subc_subc_arg_type_tt)+,
|
||||
THEN { values_t!(subsubmatches, stringify!($subc_subc_arg), inner_vec_type!($($subc_subc_arg_type_tt)+)).ok() }
|
||||
ELSE { value_t!(subsubmatches, stringify!($subc_subc_arg), $($subc_subc_arg_type_tt)+).ok() }
|
||||
)
|
||||
}
|
||||
);
|
||||
)*
|
||||
}
|
||||
else {
|
||||
raw_args.$subc_subc = false;
|
||||
}
|
||||
)*
|
||||
}
|
||||
else {
|
||||
raw_args.$subc = false;
|
||||
}
|
||||
)*
|
||||
|
||||
Ok(raw_args)
|
||||
}
|
||||
|
||||
fn usage() -> String {
|
||||
format!(
|
||||
include_str!("./usage.txt"),
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn usages_valid() {
|
||||
let re = Regex::new(r"^(?:(-[a-zA-Z-]+, )?--[a-z-]+(=\[[a-zA-Z]+\](\.\.\.)?|=<[a-zA-Z]+>(\.\.\.)?)?)|(?:\[[a-zA-Z-]+\])(\.\.\.)?|(?:<[a-zA-Z-]+>)(\.\.\.)?$").unwrap();
|
||||
|
||||
let usages = vec![
|
||||
$(
|
||||
$(
|
||||
$field={ let v: $typ = $default.into(); v },
|
||||
// Uncomment this to debug
|
||||
// "named argument never used" error
|
||||
// $field = $default,
|
||||
$(
|
||||
$subc_subc_arg_usage,
|
||||
)*
|
||||
)*
|
||||
$(
|
||||
$field_s = $default_s,
|
||||
$subc_arg_usage,
|
||||
)*
|
||||
)
|
||||
)*
|
||||
$(
|
||||
$(
|
||||
$flag_usage,
|
||||
)*
|
||||
$(
|
||||
$arg_usage,
|
||||
)*
|
||||
)*
|
||||
];
|
||||
|
||||
for usage in &usages {
|
||||
assert!(re.is_match(usage));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,499 +0,0 @@
|
||||
Parity. Ethereum Client.
|
||||
By Wood/Paronyan/Kotewicz/Drwięga/Volf et al.
|
||||
Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd
|
||||
|
||||
Usage:
|
||||
parity [options]
|
||||
parity ui [options]
|
||||
parity dapp <path> [options]
|
||||
parity daemon <pid-file> [options]
|
||||
parity account (new | list ) [options]
|
||||
parity account import <path>... [options]
|
||||
parity wallet import <path> --password FILE [options]
|
||||
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>
|
||||
parity db kill [options]
|
||||
|
||||
Operating Options:
|
||||
--mode MODE Set the operating mode. MODE can be one of:
|
||||
last - Uses the last-used mode, active if none.
|
||||
active - Parity continuously syncs the chain.
|
||||
passive - Parity syncs initially, then sleeps and
|
||||
wakes regularly to resync.
|
||||
dark - Parity syncs only when the RPC is active.
|
||||
offline - Parity doesn't sync. (default: {flag_mode}).
|
||||
--mode-timeout SECS Specify the number of seconds before inactivity
|
||||
timeout occurs when mode is dark or passive
|
||||
(default: {flag_mode_timeout}).
|
||||
--mode-alarm SECS Specify the number of seconds before auto sleep
|
||||
reawake timeout occurs when mode is passive
|
||||
(default: {flag_mode_alarm}).
|
||||
--auto-update SET Set a releases set to automatically update and
|
||||
install.
|
||||
all - All updates in the our release track.
|
||||
critical - Only consensus/security updates.
|
||||
none - No updates will be auto-installed.
|
||||
(default: {flag_auto_update}).
|
||||
--release-track TRACK Set which release track we should use for updates.
|
||||
stable - Stable releases.
|
||||
beta - Beta releases.
|
||||
nightly - Nightly releases (unstable).
|
||||
testing - Testing releases (do not use).
|
||||
current - Whatever track this executable was
|
||||
released on (default: {flag_release_track}).
|
||||
--public-node Start Parity as a public web server. Account storage
|
||||
and transaction signing will be delegated to the UI.
|
||||
(default: {flag_public_node}).
|
||||
--no-download Normally new releases will be downloaded ready for
|
||||
updating. This disables it. Not recommended.
|
||||
(default: {flag_no_download}).
|
||||
--no-consensus Force the binary to run even if there are known
|
||||
issues regarding consensus. Not recommended.
|
||||
(default: {flag_no_consensus}).
|
||||
--force-direct Run the originally installed version of Parity,
|
||||
ignoring any updates that have since been installed.
|
||||
--chain CHAIN Specify the blockchain type. CHAIN may be either a
|
||||
JSON chain specification file or olympic, frontier,
|
||||
homestead, mainnet, morden, ropsten, classic, expanse,
|
||||
testnet, kovan or dev (default: {flag_chain}).
|
||||
-d --base-path PATH Specify the base data storage path.
|
||||
(default: {flag_base_path}).
|
||||
--db-path PATH Specify the database directory path
|
||||
(default: {flag_db_path}).
|
||||
--keys-path PATH Specify the path for JSON key files to be found
|
||||
(default: {flag_keys_path}).
|
||||
--identity NAME Specify your node's name. (default: {flag_identity})
|
||||
--light Experimental: run in light client mode. Light clients
|
||||
synchronize a bare minimum of data and fetch necessary
|
||||
data on-demand from the network. Much lower in storage,
|
||||
potentially higher in bandwidth. Has no effect with
|
||||
subcommands (default: {flag_light}).
|
||||
|
||||
Convenience Options:
|
||||
-c --config CONFIG Specify a configuration. CONFIG may be either a
|
||||
configuration file or a preset: dev, insecure, dev-insecure,
|
||||
mining, or non-standard-ports.
|
||||
(default: {flag_config}).
|
||||
--ports-shift SHIFT Add SHIFT to all port numbers Parity is listening on.
|
||||
Includes network port and all servers (RPC, WebSockets, UI, IPFS, SecretStore).
|
||||
(default: {flag_ports_shift})
|
||||
--unsafe-expose All servers will listen on external interfaces and will
|
||||
be remotely accessible. It's equivalent with setting
|
||||
the following: --{{ws,jsonrpc,ui,ipfs,secret_store,stratum}}-interface=all --*-hosts=all
|
||||
This option is UNSAFE and should be used with great care!
|
||||
(default: {flag_unsafe_expose})
|
||||
|
||||
Account Options:
|
||||
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
||||
ACCOUNTS is a comma-delimited list of addresses.
|
||||
Implies --no-ui. (default: {flag_unlock:?})
|
||||
--password FILE Provide a file containing a password for unlocking
|
||||
an account. Leading and trailing whitespace is trimmed.
|
||||
(default: {flag_password:?})
|
||||
--keys-iterations NUM Specify the number of iterations to use when
|
||||
deriving key from the password (bigger is more
|
||||
secure) (default: {flag_keys_iterations}).
|
||||
--no-hardware-wallets Disables hardware wallet support. (default: {flag_no_hardware_wallets})
|
||||
--fast-unlock Use drasticly faster unlocking mode. This setting causes
|
||||
raw secrets to be stored unprotected in memory,
|
||||
so use with care. (default: {flag_fast_unlock})
|
||||
|
||||
UI Options:
|
||||
--force-ui Enable Trusted UI WebSocket endpoint,
|
||||
even when --unlock is in use. (default: {flag_force_ui})
|
||||
--no-ui Disable Trusted UI WebSocket endpoint.
|
||||
(default: {flag_no_ui})
|
||||
--ui-port PORT Specify the port of Trusted UI server
|
||||
(default: {flag_ui_port}).
|
||||
--ui-interface IP Specify the hostname portion of the Trusted UI
|
||||
server, IP should be an interface's IP address,
|
||||
or local (default: {flag_ui_interface}).
|
||||
--ui-hosts HOSTS List of allowed Host header values. This option will
|
||||
validate the Host header sent by the browser, it
|
||||
is additional security against some attack
|
||||
vectors. Special options: "all", "none",
|
||||
(default: {flag_ui_hosts}).
|
||||
--ui-path PATH Specify directory where Trusted UIs tokens should
|
||||
be stored. (default: {flag_ui_path})
|
||||
--ui-no-validation Disable Origin and Host headers validation for
|
||||
Trusted UI. WARNING: INSECURE. Used only for
|
||||
development. (default: {flag_ui_no_validation})
|
||||
|
||||
Networking Options:
|
||||
--no-warp Disable syncing from the snapshot over the network. (default: {flag_no_warp})
|
||||
--port PORT Override the port on which the node should listen
|
||||
(default: {flag_port}).
|
||||
--min-peers NUM Try to maintain at least NUM peers (default: {flag_min_peers}).
|
||||
--max-peers NUM Allow up to NUM peers (default: {flag_max_peers}).
|
||||
--snapshot-peers NUM Allow additional NUM peers for a snapshot sync
|
||||
(default: {flag_snapshot_peers}).
|
||||
--nat METHOD Specify method to use for determining public
|
||||
address. Must be one of: any, none, upnp,
|
||||
extip:<IP> (default: {flag_nat}).
|
||||
--network-id INDEX Override the network identifier from the chain we
|
||||
are on. (default: {flag_network_id:?})
|
||||
--bootnodes NODES Override the bootnodes from our chain. NODES should
|
||||
be comma-delimited enodes. (default: {flag_bootnodes:?})
|
||||
--no-discovery Disable new peer discovery. (default: {flag_no_discovery})
|
||||
--node-key KEY Specify node secret key, either as 64-character hex
|
||||
string or input to SHA3 operation. (default: {flag_node_key:?})
|
||||
--reserved-peers FILE Provide a file containing enodes, one per line.
|
||||
These nodes will always have a reserved slot on top
|
||||
of the normal maximum peers. (default: {flag_reserved_peers:?})
|
||||
--reserved-only Connect only to reserved nodes. (default: {flag_reserved_only})
|
||||
--allow-ips FILTER Filter outbound connections. FILTER can be one of:
|
||||
private - connect to private network IP addresses only;
|
||||
public - connect to public network IP addresses only;
|
||||
all - connect to any IP address;
|
||||
none - block all (for use with a custom filter as below);
|
||||
a custom filter list in the format: "private ip_range1 -ip_range2 ...".
|
||||
Where ip_range1 would be allowed and ip_range2 blocked;
|
||||
Custom blocks ("-ip_range") override custom allows ("ip_range");
|
||||
(default: {flag_allow_ips}).
|
||||
--max-pending-peers NUM Allow up to NUM pending connections. (default: {flag_max_pending_peers})
|
||||
--no-ancient-blocks Disable downloading old blocks after snapshot restoration
|
||||
or warp sync. (default: {flag_no_ancient_blocks})
|
||||
--no-serve-light Disable serving of light peers. (default: {flag_no_serve_light})
|
||||
|
||||
API and Console Options:
|
||||
--no-jsonrpc Disable the JSON-RPC API server. (default: {flag_no_jsonrpc})
|
||||
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server
|
||||
(default: {flag_jsonrpc_port}).
|
||||
--jsonrpc-interface IP Specify the hostname portion of the JSONRPC API
|
||||
server, IP should be an interface's IP address, or
|
||||
all (all interfaces) or local (default: {flag_jsonrpc_interface}).
|
||||
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses.
|
||||
(default: {flag_jsonrpc_cors:?})
|
||||
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
|
||||
interface. APIS is a comma-delimited list of API
|
||||
name. Possible name are all, safe, web3, eth, net, personal,
|
||||
parity, parity_set, traces, rpc, parity_accounts.
|
||||
You can also disable a specific API by putting '-' in the front: all,-personal
|
||||
(default: {flag_jsonrpc_apis}).
|
||||
--jsonrpc-hosts HOSTS List of allowed Host header values. This option will
|
||||
validate the Host header sent by the browser, it
|
||||
is additional security against some attack
|
||||
vectors. Special options: "all", "none",
|
||||
(default: {flag_jsonrpc_hosts}).
|
||||
--jsonrpc-server-threads NUM Enables experimental faster implementation of JSON-RPC server.
|
||||
Requires Dapps server to be disabled
|
||||
using --no-dapps. (default: {flag_jsonrpc_server_threads:?})
|
||||
--jsonrpc-threads THREADS Turn on additional processing threads in all RPC servers.
|
||||
Setting this to non-zero value allows parallel cpu-heavy queries
|
||||
execution. (default: {flag_jsonrpc_threads})
|
||||
|
||||
--no-ws Disable the WebSockets server. (default: {flag_no_ws})
|
||||
--ws-port PORT Specify the port portion of the WebSockets server
|
||||
(default: {flag_ws_port}).
|
||||
--ws-interface IP Specify the hostname portion of the WebSockets
|
||||
server, IP should be an interface's IP address, or
|
||||
all (all interfaces) or local (default: {flag_ws_interface}).
|
||||
--ws-apis APIS Specify the APIs available through the WebSockets
|
||||
interface. APIS is a comma-delimited list of API
|
||||
name. Possible name are web3, eth, pubsub, net, personal,
|
||||
parity, parity_set, traces, rpc, parity_accounts.
|
||||
(default: {flag_ws_apis}).
|
||||
--ws-origins URL Specify Origin header values allowed to connect.
|
||||
Special options: "all", "none".
|
||||
(default: {flag_ws_origins})
|
||||
--ws-hosts HOSTS List of allowed Host header values. This option will
|
||||
validate the Host header sent by the browser, it
|
||||
is additional security against some attack
|
||||
vectors. Special options: "all", "none",
|
||||
(default: {flag_ws_hosts}).
|
||||
|
||||
--no-ipc Disable JSON-RPC over IPC service. (default: {flag_no_ipc})
|
||||
--ipc-path PATH Specify custom path for JSON-RPC over IPC service
|
||||
(default: {flag_ipc_path}).
|
||||
--ipc-apis APIS Specify custom API set available via JSON-RPC over
|
||||
IPC (default: {flag_ipc_apis}).
|
||||
|
||||
--no-dapps Disable the Dapps server (e.g. status page). (default: {flag_no_dapps})
|
||||
--dapps-path PATH Specify directory where dapps should be installed.
|
||||
(default: {flag_dapps_path})
|
||||
--ipfs-api Enable IPFS-compatible HTTP API. (default: {flag_ipfs_api})
|
||||
--ipfs-api-port PORT Configure on which port the IPFS HTTP API should listen.
|
||||
(default: {flag_ipfs_api_port})
|
||||
--ipfs-api-interface IP Specify the hostname portion of the IPFS API server,
|
||||
IP should be an interface's IP address or local.
|
||||
(default: {flag_ipfs_api_interface})
|
||||
--ipfs-api-cors URL Specify CORS header for IPFS API responses.
|
||||
(default: {flag_ipfs_api_cors:?})
|
||||
--ipfs-api-hosts HOSTS List of allowed Host header values. This option will
|
||||
validate the Host header sent by the browser, it
|
||||
is additional security against some attack
|
||||
vectors. Special options: "all", "none"
|
||||
(default: {flag_ipfs_api_hosts}).
|
||||
|
||||
Secret Store Options:
|
||||
--no-secretstore Disable Secret Store functionality. (default: {flag_no_secretstore})
|
||||
--no-secretstore-http Disable Secret Store HTTP API. (default: {flag_no_secretstore_http})
|
||||
--no-acl-check Disable ACL check (useful for test environments). (default: {flag_no_secretstore_acl_check})
|
||||
--secretstore-secret SECRET Hex-encoded secret key of this node.
|
||||
(required, default: {flag_secretstore_secret:?}).
|
||||
--secretstore-nodes NODES Comma-separated list of other secret store cluster nodes in form
|
||||
NODE_PUBLIC_KEY_IN_HEX@NODE_IP_ADDR:NODE_PORT.
|
||||
(required, default: {flag_secretstore_nodes}).
|
||||
--secretstore-interface IP Specify the hostname portion for listening to Secret Store Key Server
|
||||
internal requests, IP should be an interface's IP address, or local
|
||||
(default: {flag_secretstore_interface}).
|
||||
--secretstore-port PORT Specify the port portion for listening to Secret Store Key Server
|
||||
internal requests (default: {flag_secretstore_port}).
|
||||
--secretstore-http-interface IP Specify the hostname portion for listening to Secret Store Key Server
|
||||
HTTP requests, IP should be an interface's IP address, or local
|
||||
(default: {flag_secretstore_http_interface}).
|
||||
--secretstore-http-port PORT Specify the port portion for listening to Secret Store Key Server
|
||||
HTTP requests (default: {flag_secretstore_http_port}).
|
||||
--secretstore-path PATH Specify directory where Secret Store should save its data.
|
||||
(default: {flag_secretstore_path}).
|
||||
|
||||
Sealing/Mining Options:
|
||||
--author ADDRESS Specify the block author (aka "coinbase") address
|
||||
for sending block rewards from sealed blocks.
|
||||
NOTE: MINING WILL NOT WORK WITHOUT THIS OPTION.
|
||||
(default: {flag_author:?})
|
||||
--engine-signer ADDRESS Specify the address which should be used to
|
||||
sign consensus messages and issue blocks.
|
||||
Relevant only to non-PoW chains.
|
||||
(default: {flag_engine_signer:?})
|
||||
--force-sealing Force the node to author new blocks as if it were
|
||||
always sealing/mining.
|
||||
(default: {flag_force_sealing})
|
||||
--reseal-on-txs SET Specify which transactions should force the node
|
||||
to reseal a block. SET is one of:
|
||||
none - never reseal on new transactions;
|
||||
own - reseal only on a new local transaction;
|
||||
ext - reseal only on a new external transaction;
|
||||
all - reseal on all new transactions
|
||||
(default: {flag_reseal_on_txs}).
|
||||
--reseal-on-uncle Force the node to author new blocks when a new uncle
|
||||
block is imported.
|
||||
(default: {flag_reseal_on_uncle})
|
||||
--reseal-min-period MS Specify the minimum time between reseals from
|
||||
incoming transactions. MS is time measured in
|
||||
milliseconds (default: {flag_reseal_min_period}).
|
||||
--reseal-max-period MS Specify the maximum time since last block to enable
|
||||
force-sealing. MS is time measured in
|
||||
milliseconds (default: {flag_reseal_max_period}).
|
||||
--work-queue-size ITEMS Specify the number of historical work packages
|
||||
which are kept cached lest a solution is found for
|
||||
them later. High values take more memory but result
|
||||
in fewer unusable solutions (default: {flag_work_queue_size}).
|
||||
--tx-gas-limit GAS Apply a limit of GAS as the maximum amount of gas
|
||||
a single transaction may have for it to be mined.
|
||||
(default: {flag_tx_gas_limit:?})
|
||||
--tx-time-limit MS Maximal time for processing single transaction.
|
||||
If enabled senders/recipients/code of transactions
|
||||
offending the limit will be banned from being included
|
||||
in transaction queue for 180 seconds.
|
||||
(default: {flag_tx_time_limit:?})
|
||||
--relay-set SET Set of transactions to relay. SET may be:
|
||||
cheap - Relay any transaction in the queue (this
|
||||
may include invalid transactions);
|
||||
strict - Relay only executed transactions (this
|
||||
guarantees we don't relay invalid transactions, but
|
||||
means we relay nothing if not mining);
|
||||
lenient - Same as strict when mining, and cheap
|
||||
when not (default: {flag_relay_set}).
|
||||
--min-gas-price WEI Minimum amount of Wei per GAS to be paid for a
|
||||
transaction to be accepted for mining. Overrides
|
||||
--basic-tx-usd.
|
||||
(default: {flag_min_gas_price:?})
|
||||
--usd-per-tx USD Amount of USD to be paid for a basic transaction
|
||||
(default: {flag_usd_per_tx}). The minimum gas price is set
|
||||
accordingly.
|
||||
--usd-per-eth SOURCE USD value of a single ETH. SOURCE may be either an
|
||||
amount in USD, a web service or 'auto' to use each
|
||||
web service in turn and fallback on the last known
|
||||
good value (default: {flag_usd_per_eth}).
|
||||
--price-update-period T T will be allowed to pass between each gas price
|
||||
update. T may be daily, hourly, a number of seconds,
|
||||
or a time string of the form "2 days", "30 minutes"
|
||||
etc. (default: {flag_price_update_period}).
|
||||
--gas-floor-target GAS Amount of gas per block to target when sealing a new
|
||||
block (default: {flag_gas_floor_target}).
|
||||
--gas-cap GAS A cap on how large we will raise the gas limit per
|
||||
block due to transaction volume (default: {flag_gas_cap}).
|
||||
--extra-data STRING Specify a custom extra-data for authored blocks, no
|
||||
more than 32 characters. (default: {flag_extra_data:?})
|
||||
--tx-queue-mem-limit MB Maximum amount of memory that can be used by the
|
||||
transaction queue. Setting this parameter to 0
|
||||
disables limiting (default: {flag_tx_queue_mem_limit}).
|
||||
--tx-queue-size LIMIT Maximum amount of transactions in the queue (waiting
|
||||
to be included in next block) (default: {flag_tx_queue_size}).
|
||||
--tx-queue-gas LIMIT Maximum amount of total gas for external transactions in
|
||||
the queue. LIMIT can be either an amount of gas or
|
||||
'auto' or 'off'. 'auto' sets the limit to be 20x
|
||||
the current block gas limit. (default: {flag_tx_queue_gas}).
|
||||
--tx-queue-strategy S Prioritization strategy used to order transactions
|
||||
in the queue. S may be:
|
||||
gas - Prioritize txs with low gas limit;
|
||||
gas_price - Prioritize txs with high gas price;
|
||||
gas_factor - Prioritize txs using gas price
|
||||
and gas limit ratio (default: {flag_tx_queue_strategy}).
|
||||
--tx-queue-ban-count C Number of times maximal time for execution (--tx-time-limit)
|
||||
can be exceeded before banning sender/recipient/code.
|
||||
(default: {flag_tx_queue_ban_count})
|
||||
--tx-queue-ban-time SEC Banning time (in seconds) for offenders of specified
|
||||
execution time limit. Also number of offending actions
|
||||
have to reach the threshold within that time.
|
||||
(default: {flag_tx_queue_ban_time} seconds)
|
||||
--no-persistent-txqueue Don't save pending local transactions to disk to be
|
||||
restored whenever the node restarts.
|
||||
(default: {flag_no_persistent_txqueue}).
|
||||
--remove-solved Move solved blocks from the work package queue
|
||||
instead of cloning them. This gives a slightly
|
||||
faster import speed, but means that extra solutions
|
||||
submitted for the same work package will go unused.
|
||||
(default: {flag_remove_solved})
|
||||
--notify-work URLS URLs to which work package notifications are pushed.
|
||||
URLS should be a comma-delimited list of HTTP URLs.
|
||||
(default: {flag_notify_work:?})
|
||||
--refuse-service-transactions Always refuse service transactions.
|
||||
(default: {flag_refuse_service_transactions}).
|
||||
--stratum Run Stratum server for miner push notification. (default: {flag_stratum})
|
||||
--stratum-interface IP Interface address for Stratum server. (default: {flag_stratum_interface})
|
||||
--stratum-port PORT Port for Stratum server to listen on. (default: {flag_stratum_port})
|
||||
--stratum-secret STRING Secret for authorizing Stratum server for peers.
|
||||
(default: {flag_stratum_secret:?})
|
||||
|
||||
Footprint Options:
|
||||
--tracing BOOL Indicates if full transaction tracing should be
|
||||
enabled. Works only if client had been fully synced
|
||||
with tracing enabled. BOOL may be one of auto, on,
|
||||
off. auto uses last used value of this option (off
|
||||
if it does not exist) (default: {flag_tracing}).
|
||||
--pruning METHOD Configure pruning of the state/storage trie. METHOD
|
||||
may be one of auto, archive, fast:
|
||||
archive - keep all state trie data. No pruning.
|
||||
fast - maintain journal overlay. Fast but 50MB used.
|
||||
auto - use the method most recently synced or
|
||||
default to fast if none synced (default: {flag_pruning}).
|
||||
--pruning-history NUM Set a minimum number of recent states to keep when pruning
|
||||
is active. (default: {flag_pruning_history}).
|
||||
--pruning-memory MB The ideal amount of memory in megabytes to use to store
|
||||
recent states. As many states as possible will be kept
|
||||
within this limit, and at least --pruning-history states
|
||||
will always be kept. (default: {flag_pruning_memory})
|
||||
--cache-size-db MB Override database cache size (default: {flag_cache_size_db}).
|
||||
--cache-size-blocks MB Specify the prefered size of the blockchain cache in
|
||||
megabytes (default: {flag_cache_size_blocks}).
|
||||
--cache-size-queue MB Specify the maximum size of memory to use for block
|
||||
queue (default: {flag_cache_size_queue}).
|
||||
--cache-size-state MB Specify the maximum size of memory to use for
|
||||
the state cache (default: {flag_cache_size_state}).
|
||||
--cache-size MB Set total amount of discretionary memory to use for
|
||||
the entire system, overrides other cache and queue
|
||||
options. (default: {flag_cache_size:?})
|
||||
--fast-and-loose Disables DB WAL, which gives a significant speed up
|
||||
but means an unclean exit is unrecoverable. (default: {flag_fast_and_loose})
|
||||
--db-compaction TYPE Database compaction type. TYPE may be one of:
|
||||
ssd - suitable for SSDs and fast HDDs;
|
||||
hdd - suitable for slow HDDs;
|
||||
auto - determine automatically (default: {flag_db_compaction}).
|
||||
--fat-db BOOL Build appropriate information to allow enumeration
|
||||
of all accounts and storage keys. Doubles the size
|
||||
of the state database. BOOL may be one of on, off
|
||||
or auto. (default: {flag_fat_db})
|
||||
--scale-verifiers Automatically scale amount of verifier threads based on
|
||||
workload. Not guaranteed to be faster.
|
||||
(default: {flag_scale_verifiers})
|
||||
--num-verifiers INT Amount of verifier threads to use or to begin with, if verifier
|
||||
auto-scaling is enabled. (default: {flag_num_verifiers:?})
|
||||
|
||||
Import/Export Options:
|
||||
--from BLOCK Export from block BLOCK, which may be an index or
|
||||
hash (default: {flag_from}).
|
||||
--to BLOCK Export to (including) block BLOCK, which may be an
|
||||
index, hash or 'latest' (default: {flag_to}).
|
||||
--format FORMAT For import/export in given format. FORMAT must be
|
||||
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'. (default: {flag_at})
|
||||
--no-storage Don't export account storage. (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
|
||||
index, hash, or 'latest'. Note that taking snapshots at
|
||||
non-recent blocks will only work with --pruning archive
|
||||
(default: {flag_at})
|
||||
--no-periodic-snapshot Disable automated snapshots which usually occur once
|
||||
every 10000 blocks. (default: {flag_no_periodic_snapshot})
|
||||
|
||||
Virtual Machine Options:
|
||||
--jitvm Enable the JIT VM. (default: {flag_jitvm})
|
||||
|
||||
Whisper Options:
|
||||
--whisper Enable the Whisper network. (default: {flag_whisper})
|
||||
--whisper-pool-size MB Target size of the whisper message pool in megabytes.
|
||||
(default: {flag_whisper_pool_size})
|
||||
|
||||
Legacy Options:
|
||||
--geth Run in Geth-compatibility mode. Sets the IPC path
|
||||
to be the same as Geth's. Overrides the --ipc-path
|
||||
and --ipcpath options. Alters RPCs to reflect Geth
|
||||
bugs. Includes the personal_ RPC by default.
|
||||
--testnet Testnet mode. Equivalent to --chain testnet.
|
||||
Overrides the --keys-path option.
|
||||
--import-geth-keys Attempt to import keys from Geth client.
|
||||
--datadir PATH Equivalent to --base-path PATH.
|
||||
--networkid INDEX Equivalent to --network-id INDEX.
|
||||
--peers NUM Equivalent to --min-peers NUM.
|
||||
--nodekey KEY Equivalent to --node-key KEY.
|
||||
--nodiscover Equivalent to --no-discovery.
|
||||
-j --jsonrpc Does nothing; JSON-RPC is on by default now.
|
||||
--jsonrpc-off Equivalent to --no-jsonrpc.
|
||||
-w --webapp Does nothing; dapps server is on by default now.
|
||||
--dapps-off Equivalent to --no-dapps.
|
||||
--dapps-user USERNAME Dapps server authentication has been removed. (default: {flag_dapps_user:?})
|
||||
--dapps-pass PASSWORD Dapps server authentication has been removed. (default: {flag_dapps_pass:?})
|
||||
--dapps-apis-all Dapps server is merged with RPC server. Use --jsonrpc-apis. (default: {flag_dapps_apis_all:?})
|
||||
--dapps-cors URL Dapps server is merged with RPC server. Use --jsonrpc-cors. (default: {flag_dapps_cors:?})
|
||||
--dapps-hosts HOSTS Dapps server is merged with RPC server. Use --jsonrpc-hosts. (default: {flag_dapps_hosts:?})
|
||||
--dapps-interface IP Dapps server is merged with RPC server. Use --jsonrpc-interface. (default: {flag_dapps_interface:?})
|
||||
--dapps-port PORT Dapps server is merged with RPC server. Use --jsonrpc-port. (default: {flag_dapps_port:?})
|
||||
--rpc Does nothing; JSON-RPC is on by default now.
|
||||
--warp Does nothing; Warp sync is on by default. (default: {flag_warp})
|
||||
--rpcaddr IP Equivalent to --jsonrpc-interface IP.
|
||||
--rpcport PORT Equivalent to --jsonrpc-port PORT.
|
||||
--rpcapi APIS Equivalent to --jsonrpc-apis APIS.
|
||||
--rpccorsdomain URL Equivalent to --jsonrpc-cors URL.
|
||||
--ipcdisable Equivalent to --no-ipc.
|
||||
--ipc-off Equivalent to --no-ipc.
|
||||
--ipcapi APIS Equivalent to --ipc-apis APIS.
|
||||
--ipcpath PATH Equivalent to --ipc-path PATH.
|
||||
--gasprice WEI Equivalent to --min-gas-price WEI.
|
||||
--etherbase ADDRESS Equivalent to --author ADDRESS.
|
||||
--extradata STRING Equivalent to --extra-data STRING.
|
||||
--cache MB Equivalent to --cache-size MB.
|
||||
|
||||
Internal Options:
|
||||
--can-restart Executable will auto-restart if exiting with 69.
|
||||
|
||||
Miscellaneous Options:
|
||||
--ntp-servers HOSTS Comma separated list of NTP servers to provide current time (host:port).
|
||||
Used to verify node health. Parity uses pool.ntp.org NTP servers,
|
||||
consider joining the pool: http://www.pool.ntp.org/join.html
|
||||
(default: {flag_ntp_servers})
|
||||
-l --logging LOGGING Specify the logging level. Must conform to the same
|
||||
format as RUST_LOG. (default: {flag_logging:?})
|
||||
--log-file FILENAME Specify a filename into which logging should be
|
||||
appended. (default: {flag_log_file:?})
|
||||
--no-config Don't load a configuration file.
|
||||
--no-color Don't use terminal color codes in output. (default: {flag_no_color})
|
||||
-v --version Show information about version.
|
||||
-h --help Show this screen.
|
||||
3
parity/cli/usage_header.txt
Normal file
3
parity/cli/usage_header.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Parity. Ethereum Client.
|
||||
By Wood/Paronyan/Kotewicz/Drwięga/Volf et al.
|
||||
Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd
|
||||
@@ -7,4 +7,3 @@ There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
By Wood/Paronyan/Kotewicz/Drwięga/Volf
|
||||
Habermeier/Czaban/Greeff/Gotchac/Redmann
|
||||
|
||||
|
||||
Reference in New Issue
Block a user