From 78f502b4c47d76cc81ea8295fd97df64bd5faf2e Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Mon, 15 Jan 2018 16:27:10 +0100 Subject: [PATCH 1/7] Update Clap dependency and remove workarounds --- Cargo.lock | 39 +++++++++++--------------- parity/cli/usage.rs | 68 +++++++++++++++++++-------------------------- 2 files changed, 45 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 461dbd5f494..f68675fab5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,6 +25,11 @@ name = "ansi_term" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ansi_term" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "app_dirs" version = "1.1.1" @@ -233,15 +238,14 @@ dependencies = [ [[package]] name = "clap" -version = "2.26.2" +version = "2.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1948,7 +1952,7 @@ version = "1.10.0" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)", "daemonize 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "dir 0.1.0", @@ -2538,7 +2542,7 @@ dependencies = [ name = "pwasm-run-test" version = "0.1.0" dependencies = [ - "clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-logger 1.9.0", "ethereum-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "ethjson 0.1.0", @@ -3141,22 +3145,11 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "term_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3526,7 +3519,7 @@ version = "0.1.0" source = "git+https://github.com/paritytech/wasm-utils#3d59f7ca0661317bc66894a26b2a5a319fa5d229" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3605,6 +3598,7 @@ dependencies = [ "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45" "checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" +"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7d1c0d48a81bbb13043847f957971f4d87c81542d80ece5e84ba3cba4058fd4" "checksum arrayvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1c0250693b17316353df525fb088da32a8c18f84eb65d113dde31f5a76ed17b6" @@ -3630,7 +3624,7 @@ dependencies = [ "checksum cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7db2f146208d7e0fbee761b09cd65a7f51ccc38705d4e7262dad4d73b12a76b1" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum cid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34aa7da06f10541fbca6850719cdaa8fa03060a5d2fb33840f149cf8133a00c7" -"checksum clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3451e409013178663435d6f15fdb212f14ee4424a3d74f979d081d0a66b6f1f2" +"checksum clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f4a2b3bb7ef3c672d7c13d15613211d5a6976b6892c598b0fcb5d40765f19c2" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" "checksum cookie 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d53b80dde876f47f03cda35303e368a79b91c70b0d65ecba5fd5280944a08591" @@ -3837,8 +3831,7 @@ dependencies = [ "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209" -"checksum textwrap 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8e08afc40ae3459e4838f303e465aa50d823df8d7f83ca88108f6d3afe7edd" +"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 91524c165ae..87515b4b1d4 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -153,7 +153,7 @@ macro_rules! usage { use std::{fs, io, process}; use std::io::{Read, Write}; use parity_version::version; - use clap::{Arg, App, SubCommand, AppSettings, ArgMatches as ClapArgMatches, Error as ClapError, ErrorKind as ClapErrorKind}; + use clap::{Arg, App, SubCommand, AppSettings, Error as ClapError, ErrorKind as ClapErrorKind}; use dir::helpers::replace_home; use std::ffi::OsStr; use std::collections::HashMap; @@ -503,36 +503,6 @@ macro_rules! usage { args } - pub fn hydrate_with_globals(self: &mut Self, matches: &ClapArgMatches) -> Result<(), ClapError> { - $( - $( - self.$flag = self.$flag || matches.is_present(stringify!($flag)); - )* - $( - if let some @ Some(_) = return_if_parse_error!(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)+)) } - ELSE { value_t!(matches, stringify!($arg), inner_option_type!($($arg_type_tt)+)) } - ) - } - ELSE { - if_vec!( - $($arg_type_tt)+, - THEN { values_t!(matches, stringify!($arg), inner_vec_type!($($arg_type_tt)+)) } - ELSE { value_t!(matches, stringify!($arg), $($arg_type_tt)+) } - ) - } - )) { - self.$arg = some; - } - )* - )* - Ok(()) - } - #[allow(unused_variables)] // the submatches of arg-less subcommands aren't used pub fn parse>(command: &[S]) -> Result { @@ -583,20 +553,18 @@ macro_rules! usage { .global_setting(AppSettings::VersionlessSubcommands) .global_setting(AppSettings::DisableHelpSubcommand) .help(Args::print_help().as_ref()) - .args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::>()) + .args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true).global(true)).collect::>()) $( .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).allow_hyphen_values(true)).collect::>()) - .args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::>()) // accept global arguments at this position $( .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).allow_hyphen_values(true)).collect::>()) - .args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true)).collect::>()) // accept global arguments at this position ) )* ) @@ -605,15 +573,39 @@ macro_rules! usage { let mut raw_args : RawArgs = Default::default(); - raw_args.hydrate_with_globals(&matches)?; + // Globals + $( + $( + raw_args.$flag = raw_args.$flag || matches.is_present(stringify!($flag)); + )* + $( + if let some @ Some(_) = return_if_parse_error!(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)+)) } + ELSE { value_t!(matches, stringify!($arg), inner_option_type!($($arg_type_tt)+)) } + ) + } + ELSE { + if_vec!( + $($arg_type_tt)+, + THEN { values_t!(matches, stringify!($arg), inner_vec_type!($($arg_type_tt)+)) } + ELSE { value_t!(matches, stringify!($arg), $($arg_type_tt)+) } + ) + } + )) { + raw_args.$arg = some; + } + )* + )* // Subcommands $( if let Some(submatches) = matches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc)[4..])) { raw_args.$subc = true; - // Globals - raw_args.hydrate_with_globals(&submatches)?; // Subcommand flags $( raw_args.$subc_flag = submatches.is_present(&stringify!($subc_flag)); @@ -643,8 +635,6 @@ macro_rules! usage { if let Some(subsubmatches) = submatches.subcommand_matches(&underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..])) { raw_args.$subc_subc = true; - // Globals - raw_args.hydrate_with_globals(&subsubmatches)?; // Sub-subcommand flags $( raw_args.$subc_subc_flag = subsubmatches.is_present(&stringify!($subc_subc_flag)); From 2a5c12338613b2d084fe1904171597bdfdb50821 Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Wed, 17 Jan 2018 20:04:20 +0100 Subject: [PATCH 2/7] WIP --- Cargo.lock | 20 ++++++++ Cargo.toml | 2 + parity/cli/mod.rs | 36 +++++++------- parity/cli/usage.rs | 93 +++++++++++++++++++++++++++++-------- parity/cli/usage_header.txt | 2 +- parity/cli/version.txt | 2 +- 6 files changed, 116 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f68675fab5e..1b9927557fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2012,6 +2012,8 @@ dependencies = [ "serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.9.0", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3145,6 +3147,23 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "term_size" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.9.0" +dependencies = [ + "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "textwrap" version = "0.9.0" @@ -3831,6 +3850,7 @@ dependencies = [ "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" diff --git a/Cargo.toml b/Cargo.toml index 92b5498b024..bb5d50a4a74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,8 @@ env_logger = "0.4" rustc-hex = "1.0" docopt = "0.8" clap = "2" +term_size = "0.3" +textwrap = "0.9" time = "0.1" num_cpus = "1.2" number_prefix = "0.2" diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 31fa32e2fc2..6a704f33508 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -258,11 +258,11 @@ usage! { ARG arg_mode: (String) = "last", or |c: &Config| otry!(c.parity).mode.clone(), "--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.", + 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.", ARG arg_mode_timeout: (u64) = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(), "--mode-timeout=[SECS]", @@ -275,18 +275,18 @@ usage! { ARG arg_auto_update: (String) = "critical", or |c: &Config| otry!(c.parity).auto_update.clone(), "--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.", + all - All updates in the our release track. + critical - Only consensus/security updates. + none - No updates will be auto-installed.", ARG arg_release_track: (String) = "current", or |c: &Config| otry!(c.parity).release_track.clone(), "--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", + stable - Stable releases. + beta - Beta releases. + nightly - Nightly releases (unstable). + testing - Testing releases (do not use). + current - Whatever track this executable was released on", ARG arg_chain: (String) = "foundation", or |c: &Config| otry!(c.parity).chain.clone(), "--chain=[CHAIN]", @@ -312,7 +312,7 @@ usage! { FLAG flag_unsafe_expose: (bool) = false, or |c: &Config| otry!(c.misc).unsafe_expose, "--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!", +This option is UNSAFE and should be used with great care!", ARG arg_config: (String) = "$BASE/config.toml", or |_| None, "-c, --config=[CONFIG]", @@ -498,7 +498,7 @@ usage! { ARG arg_ws_hosts: (String) = "none", or |c: &Config| otry!(c.websockets).hosts.as_ref().map(|vec| vec.join(",")), "--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\",.", + "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\".", ["API and console options – IPC"] FLAG flag_no_ipc: (bool) = false, or |c: &Config| otry!(c.ipc).disable.clone(), @@ -586,7 +586,7 @@ usage! { ARG arg_secretstore_path: (String) = "$BASE/secretstore", or |c: &Config| otry!(c.secretstore).path.clone(), "--secretstore-path=[PATH]", - "Specify directory where Secret Store should save its data..", + "Specify directory where Secret Store should save its data.", ARG arg_secretstore_secret: (Option) = None, or |c: &Config| otry!(c.secretstore).self_secret.clone(), "--secretstore-secret=[SECRET]", @@ -675,7 +675,7 @@ usage! { ARG arg_tx_queue_gas: (String) = "off", or |c: &Config| otry!(c.mining).tx_queue_gas.clone(), "--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..", + "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.", ARG arg_tx_queue_strategy: (String) = "gas_price", or |c: &Config| otry!(c.mining).tx_queue_strategy.clone(), "--tx-queue-strategy=[S]", @@ -782,7 +782,7 @@ usage! { ARG arg_pruning_history: (u64) = 64u64, or |c: &Config| otry!(c.footprint).pruning_history.clone(), "--pruning-history=[NUM]", - "Set a minimum number of recent states to keep when pruning is active..", + "Set a minimum number of recent states to keep when pruning is active.", ARG arg_pruning_memory: (usize) = 32usize, or |c: &Config| otry!(c.footprint).pruning_memory.clone(), "--pruning-memory=[MB]", diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 87515b4b1d4..3553a81596d 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -150,7 +150,7 @@ macro_rules! usage { } ) => { use toml; - use std::{fs, io, process}; + use std::{fs, io, process, cmp}; use std::io::{Read, Write}; use parity_version::version; use clap::{Arg, App, SubCommand, AppSettings, Error as ClapError, ErrorKind as ClapErrorKind}; @@ -158,6 +158,10 @@ macro_rules! usage { use std::ffi::OsStr; use std::collections::HashMap; + extern crate textwrap; + extern crate term_size; + use self::textwrap::{fill, indent}; + #[cfg(test)] use regex::Regex; @@ -365,9 +369,17 @@ macro_rules! usage { #[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 term_width = match term_size::dimensions() { + None => 100, + Some((w, _)) => { + cmp::min(w, 100) + } + }; + let mut help : String = include_str!("./usage_header.txt").to_owned(); - help.push_str("\n\n"); + help.push_str("\n"); // Subcommands help.push_str("parity [options]\n"); @@ -386,11 +398,14 @@ macro_rules! 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(" "))); - } + help.push_str(&fill( + format!( + "parity [options] {} {} {}\n", + underscore_to_hyphen!(&stringify!($subc)[4..]), + underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]), + subc_subc_usages.join(" ") + ).as_ref(), term_width) + ); )* // Print the subcommand on its own only if it has no subsubcommands @@ -404,22 +419,27 @@ macro_rules! 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(" "))); - } + help.push_str(&fill( + format!( + "parity [options] {} {}\n", + underscore_to_hyphen!(&stringify!($subc)[4..]), + subc_usages.join(" ") + ).as_ref(), term_width) + ); } } )* + help.push_str("\n"); + // 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)); + help.push_str(&format!(" {}\n{}\n", $flag_usage, + indent(fill($flag_help, term_width-8).as_ref()," ") + )); )* $( @@ -429,10 +449,24 @@ macro_rules! usage { 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})) + help.push_str(&format!(" {}\n{}\n", $arg_usage, + indent(fill(format!( + "{} (default: {:?})", + $arg_help, + {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x} + ).as_ref(), term_width-8).as_ref(), + " ") + )) } 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()))) + help.push_str(&format!(" {}\n{}\n", $arg_usage, + indent(fill(format!( + "{}{}", + $arg_help, + $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned()) + ).as_ref(), term_width-8).as_ref(), + " ") + )) } ) } @@ -440,10 +474,24 @@ macro_rules! usage { 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})) + help.push_str(&format!(" {}\n{}\n", $arg_usage, + indent(fill(format!( + "{} (default: {:?})", + $arg_help, + {let x : $($arg_type_tt)+ = $arg_default; x} + ).as_ref(), term_width-8).as_ref(), + " ") + )) } ELSE { - help.push_str(&format!("\t{}\n\t\t{} (default: {})\n", $arg_usage, $arg_help, $arg_default)) + help.push_str(&format!(" {}\n{}\n", $arg_usage, + indent(fill(format!( + "{} (default: {})", + $arg_help, + $arg_default + ).as_ref(), term_width-8).as_ref(), + " ") + )) } ) } @@ -552,8 +600,15 @@ macro_rules! usage { let matches = App::new("Parity") .global_setting(AppSettings::VersionlessSubcommands) .global_setting(AppSettings::DisableHelpSubcommand) + .max_term_width(100) .help(Args::print_help().as_ref()) - .args(&usages.iter().map(|u| Arg::from_usage(u).use_delimiter(false).allow_hyphen_values(true).global(true)).collect::>()) + .args(&usages.iter().map(|u| + Arg::from_usage(u) + .use_delimiter(false) + .allow_hyphen_values(true) // Allow for example --allow-ips -10.0.0.0/8 + .global(true) // Argument doesn't have to come before the first subcommand + .hidden(true) // Hide global arguments from the (subcommand) help messages generated by Clap + ).collect::>()) $( .subcommand( SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc)[4..])) diff --git a/parity/cli/usage_header.txt b/parity/cli/usage_header.txt index bcc0f93cb9f..0bcd776c4e0 100644 --- a/parity/cli/usage_header.txt +++ b/parity/cli/usage_header.txt @@ -1,3 +1,3 @@ Parity. Ethereum Client. By Wood/Paronyan/Kotewicz/Drwięga/Volf et al. - Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd \ No newline at end of file + Copyright 2015, 2016, 2017, 2018 Parity Technologies (UK) Ltd diff --git a/parity/cli/version.txt b/parity/cli/version.txt index 855dbb5cf81..ed0576e04d2 100644 --- a/parity/cli/version.txt +++ b/parity/cli/version.txt @@ -1,6 +1,6 @@ Parity version {} -Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd +Copyright 2015, 2016, 2017, 2018 Parity Technologies (UK) Ltd License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. From 1d2ab574425edec96c0a5c49ef7988780b2cfd19 Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Thu, 18 Jan 2018 18:18:13 +0100 Subject: [PATCH 3/7] Remove line breaks in help messages for now --- Cargo.lock | 9 +-------- parity/cli/mod.rs | 19 +++---------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b9927557fd..a2c9cbf5311 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2013,7 +2013,7 @@ dependencies = [ "serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.9.0", + "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3157,13 +3157,6 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "textwrap" -version = "0.9.0" -dependencies = [ - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" version = "0.9.0" diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 6a704f33508..daaee860c74 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -257,12 +257,7 @@ usage! { ARG arg_mode: (String) = "last", or |c: &Config| otry!(c.parity).mode.clone(), "--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.", + "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.", ARG arg_mode_timeout: (u64) = 300u64, or |c: &Config| otry!(c.parity).mode_timeout.clone(), "--mode-timeout=[SECS]", @@ -274,19 +269,11 @@ usage! { ARG arg_auto_update: (String) = "critical", or |c: &Config| otry!(c.parity).auto_update.clone(), "--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.", + "Set a releases set to automatically update and install. SET can be one of: all - All updates in the our release track; critical - Only consensus/security updates; none - No updates will be auto-installed.", ARG arg_release_track: (String) = "current", or |c: &Config| otry!(c.parity).release_track.clone(), "--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", + "Set which release track we should use for updates. TRACK can be one of: stable - Stable releases; beta - Beta releases; nightly - Nightly releases (unstable); testing - Testing releases (do not use); current - Whatever track this executable was released on.", ARG arg_chain: (String) = "foundation", or |c: &Config| otry!(c.parity).chain.clone(), "--chain=[CHAIN]", From b5163b66f46804c55965c29129a5b1cbfdc41edf Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Tue, 23 Jan 2018 18:49:50 +0100 Subject: [PATCH 4/7] Multiple values can only be separated by commas (closes #7428) --- parity/cli/mod.rs | 11 +++++++---- parity/cli/usage.rs | 21 +++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index daaee860c74..6837c6b609f 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -1314,12 +1314,15 @@ mod tests { let args = Args::parse(&["parity", "--secretstore-nodes", "abc@127.0.0.1:3333,cde@10.10.10.10:4444"]).unwrap(); assert_eq!(args.arg_secretstore_nodes, "abc@127.0.0.1:3333,cde@10.10.10.10:4444"); - // Arguments with a single value shouldn't accept multiple values - let args = Args::parse(&["parity", "--auto-update", "critical", "all"]); - assert!(args.is_err()); + let args = Args::parse(&["parity", "--password", "~/.safe/1", "--password", "~/.safe/2", "--ui-port", "8123", "ui"]).unwrap(); + assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]); + assert_eq!(args.arg_ui_port, 8123); + assert_eq!(args.cmd_ui, true); - let args = Args::parse(&["parity", "--password", "~/.safe/1", "~/.safe/2"]).unwrap(); + let args = Args::parse(&["parity", "--password", "~/.safe/1,~/.safe/2", "--ui-port", "8123", "ui"]).unwrap(); assert_eq!(args.arg_password, vec!["~/.safe/1".to_owned(), "~/.safe/2".to_owned()]); + assert_eq!(args.arg_ui_port, 8123); + assert_eq!(args.cmd_ui, true); } #[test] diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 3553a81596d..1f0b320e7df 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -153,7 +153,7 @@ macro_rules! usage { use std::{fs, io, process, cmp}; use std::io::{Read, Write}; use parity_version::version; - use clap::{Arg, App, SubCommand, AppSettings, Error as ClapError, ErrorKind as ClapErrorKind}; + use clap::{Arg, App, SubCommand, AppSettings, ArgSettings, Error as ClapError, ErrorKind as ClapErrorKind}; use dir::helpers::replace_home; use std::ffi::OsStr; use std::collections::HashMap; @@ -602,13 +602,18 @@ macro_rules! usage { .global_setting(AppSettings::DisableHelpSubcommand) .max_term_width(100) .help(Args::print_help().as_ref()) - .args(&usages.iter().map(|u| - Arg::from_usage(u) - .use_delimiter(false) - .allow_hyphen_values(true) // Allow for example --allow-ips -10.0.0.0/8 - .global(true) // Argument doesn't have to come before the first subcommand - .hidden(true) // Hide global arguments from the (subcommand) help messages generated by Clap - ).collect::>()) + .args(&usages.iter().map(|u| { + let mut arg = Arg::from_usage(u) + .allow_hyphen_values(true) // Allow for example --allow-ips -10.0.0.0/8 + .global(true) // Argument doesn't have to come before the first subcommand + .hidden(true); // Hide global arguments from the (subcommand) help messages generated by Clap + + if arg.is_set(ArgSettings::Multiple) { + arg = arg.require_delimiter(true); // Multiple values can only be separated by commas, not spaces (#7428) + } + + arg + }).collect::>()) $( .subcommand( SubCommand::with_name(&underscore_to_hyphen!(&stringify!($subc)[4..])) From 785834852f3a7a5ae0c888b6f1eb8a634785e62a Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Thu, 25 Jan 2018 18:27:04 +0100 Subject: [PATCH 5/7] Grumbles; refactor repeating code; add constant --- parity/cli/usage.rs | 76 +++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 1f0b320e7df..9fe9a4229ab 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -107,6 +107,12 @@ macro_rules! underscore_to_hyphen { ) } +macro_rules! fill_incl_prefix { + ($text:expr, $max: expr, $indent_string:expr) => ( + indent(fill($text.as_ref(), $max-$indent_string.len()).as_ref(), $indent_string) + ) +} + macro_rules! usage { ( { @@ -162,6 +168,8 @@ macro_rules! usage { extern crate term_size; use self::textwrap::{fill, indent}; + const MAX_TERM_WIDTH: usize = 100; + #[cfg(test)] use regex::Regex; @@ -370,10 +378,13 @@ macro_rules! usage { #[allow(unused_assignments)] // Rust issue #22630 pub fn print_help() -> String { + const TAB: &str = " "; + const TAB_TAB: &str = " "; + let term_width = match term_size::dimensions() { - None => 100, + None => MAX_TERM_WIDTH, Some((w, _)) => { - cmp::min(w, 100) + cmp::min(w, MAX_TERM_WIDTH) } }; @@ -437,8 +448,9 @@ macro_rules! usage { help.push_str($group_name); help.push_str(":\n"); $( - help.push_str(&format!(" {}\n{}\n", $flag_usage, - indent(fill($flag_help, term_width-8).as_ref()," ") + help.push_str(&format!("{}{}\n{}\n", + TAB, $flag_usage, + fill_incl_prefix!($flag_help, term_width, TAB_TAB) )); )* @@ -449,23 +461,23 @@ macro_rules! usage { if_option_vec!( $($arg_type_tt)+, THEN { - help.push_str(&format!(" {}\n{}\n", $arg_usage, - indent(fill(format!( - "{} (default: {:?})", - $arg_help, - {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x} - ).as_ref(), term_width-8).as_ref(), - " ") + help.push_str(&format!("{}{}\n{}\n", + TAB, $arg_usage, + fill_incl_prefix!(format!( + "{} (default: {:?})", + $arg_help, + {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x} + ), term_width, TAB_TAB) )) } ELSE { - help.push_str(&format!(" {}\n{}\n", $arg_usage, - indent(fill(format!( - "{}{}", - $arg_help, - $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned()) - ).as_ref(), term_width-8).as_ref(), - " ") + help.push_str(&format!("{}{}\n{}\n", + TAB, $arg_usage, + fill_incl_prefix!(format!( + "{}{}", + $arg_help, + $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned()) + ), term_width, TAB_TAB) )) } ) @@ -474,23 +486,21 @@ macro_rules! usage { if_vec!( $($arg_type_tt)+, THEN { - help.push_str(&format!(" {}\n{}\n", $arg_usage, - indent(fill(format!( - "{} (default: {:?})", - $arg_help, - {let x : $($arg_type_tt)+ = $arg_default; x} - ).as_ref(), term_width-8).as_ref(), - " ") + help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, + fill_incl_prefix!(format!( + "{} (default: {:?})", + $arg_help, + {let x : $($arg_type_tt)+ = $arg_default; x} + ), term_width, TAB_TAB) )) } ELSE { - help.push_str(&format!(" {}\n{}\n", $arg_usage, - indent(fill(format!( - "{} (default: {})", - $arg_help, - $arg_default - ).as_ref(), term_width-8).as_ref(), - " ") + help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, + fill_incl_prefix!(format!( + "{} (default: {})", + $arg_help, + $arg_default + ), term_width, TAB_TAB) )) } ) @@ -600,7 +610,7 @@ macro_rules! usage { let matches = App::new("Parity") .global_setting(AppSettings::VersionlessSubcommands) .global_setting(AppSettings::DisableHelpSubcommand) - .max_term_width(100) + .max_term_width(MAX_TERM_WIDTH) .help(Args::print_help().as_ref()) .args(&usages.iter().map(|u| { let mut arg = Arg::from_usage(u) From a6b3d0206e63e82a5d36a7d48901533fbb920306 Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Thu, 25 Jan 2018 19:39:30 +0100 Subject: [PATCH 6/7] Use a single Wrapper rather than allocate a new one for each call --- parity/cli/mod.rs | 3 +-- parity/cli/usage.rs | 38 ++++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 6837c6b609f..1c4df3c473c 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -298,8 +298,7 @@ usage! { ["Convenience options"] FLAG flag_unsafe_expose: (bool) = false, or |c: &Config| otry!(c.misc).unsafe_expose, "--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!", + "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!", ARG arg_config: (String) = "$BASE/config.toml", or |_| None, "-c, --config=[CONFIG]", diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 9fe9a4229ab..2005bd2c75c 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -107,12 +107,6 @@ macro_rules! underscore_to_hyphen { ) } -macro_rules! fill_incl_prefix { - ($text:expr, $max: expr, $indent_string:expr) => ( - indent(fill($text.as_ref(), $max-$indent_string.len()).as_ref(), $indent_string) - ) -} - macro_rules! usage { ( { @@ -166,7 +160,7 @@ macro_rules! usage { extern crate textwrap; extern crate term_size; - use self::textwrap::{fill, indent}; + use self::textwrap::{Wrapper}; const MAX_TERM_WIDTH: usize = 100; @@ -393,6 +387,7 @@ macro_rules! usage { help.push_str("\n"); // Subcommands + let mut subcommands_wrapper = Wrapper::new(term_width).subsequent_indent(TAB); help.push_str("parity [options]\n"); $( { @@ -409,13 +404,13 @@ macro_rules! usage { )* ]; - help.push_str(&fill( + help.push_str(&subcommands_wrapper.fill( format!( "parity [options] {} {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), underscore_to_hyphen!(&stringify!($subc_subc)[stringify!($subc).len()+1..]), subc_subc_usages.join(" ") - ).as_ref(), term_width) + ).as_ref()) ); )* @@ -430,12 +425,12 @@ macro_rules! usage { )* ]; - help.push_str(&fill( + help.push_str(&subcommands_wrapper.fill( format!( "parity [options] {} {}\n", underscore_to_hyphen!(&stringify!($subc)[4..]), subc_usages.join(" ") - ).as_ref(), term_width) + ).as_ref()) ); } } @@ -444,14 +439,16 @@ macro_rules! usage { help.push_str("\n"); // Arguments and flags + let args_wrapper = Wrapper::new(term_width).initial_indent(TAB_TAB).subsequent_indent(TAB_TAB); $( help.push_str($group_name); help.push_str(":\n"); $( help.push_str(&format!("{}{}\n{}\n", TAB, $flag_usage, - fill_incl_prefix!($flag_help, term_width, TAB_TAB) + args_wrapper.fill($flag_help) )); + help.push_str("\n"); )* $( @@ -463,21 +460,21 @@ macro_rules! usage { THEN { help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, - fill_incl_prefix!(format!( + args_wrapper.fill(format!( "{} (default: {:?})", $arg_help, {let x : inner_option_type!($($arg_type_tt)+)> = $arg_default; x} - ), term_width, TAB_TAB) + ).as_ref()) )) } ELSE { help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, - fill_incl_prefix!(format!( + args_wrapper.fill(format!( "{}{}", $arg_help, $arg_default.map(|x: inner_option_type!($($arg_type_tt)+)| format!(" (default: {})",x)).unwrap_or("".to_owned()) - ), term_width, TAB_TAB) + ).as_ref()) )) } ) @@ -487,25 +484,26 @@ macro_rules! usage { $($arg_type_tt)+, THEN { help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, - fill_incl_prefix!(format!( + args_wrapper.fill(format!( "{} (default: {:?})", $arg_help, {let x : $($arg_type_tt)+ = $arg_default; x} - ), term_width, TAB_TAB) + ).as_ref()) )) } ELSE { help.push_str(&format!("{}{}\n{}\n", TAB, $arg_usage, - fill_incl_prefix!(format!( + args_wrapper.fill(format!( "{} (default: {})", $arg_help, $arg_default - ), term_width, TAB_TAB) + ).as_ref()) )) } ) } ); + help.push_str("\n"); )* )* From 04b7ca0623913b1b5e97f157dd8a86f7b277875b Mon Sep 17 00:00:00 2001 From: Axel Chalon Date: Fri, 26 Jan 2018 15:38:01 +0100 Subject: [PATCH 7/7] Wrap --help to 120 characters rather than 100 characters --- parity/cli/usage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parity/cli/usage.rs b/parity/cli/usage.rs index 2005bd2c75c..e93eeae7bd9 100644 --- a/parity/cli/usage.rs +++ b/parity/cli/usage.rs @@ -162,7 +162,7 @@ macro_rules! usage { extern crate term_size; use self::textwrap::{Wrapper}; - const MAX_TERM_WIDTH: usize = 100; + const MAX_TERM_WIDTH: usize = 120; #[cfg(test)] use regex::Regex;