Update clap to version 4 (#1745)

* Bump to clap4

* Adjust to clap 4 style

* Remove two more deprecated occurences of clap macro

* Remove "deprecated" feature from clap

* Update cargo lock

* Fix group name

* More skipped group names
This commit is contained in:
Sebastian Kunert
2022-10-18 13:30:22 +02:00
committed by GitHub
parent 8cb818687d
commit 975403e802
9 changed files with 465 additions and 749 deletions
+421 -709
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
[dependencies]
clap = { version = "3.2.22", features = ["derive", "deprecated"] }
clap = { version = "4.0.9", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
url = "2.3.1"
+14 -12
View File
@@ -40,17 +40,18 @@ use url::Url;
/// The `purge-chain` command used to remove the whole chain: the parachain and the relay chain.
#[derive(Debug, clap::Parser)]
#[group(skip)]
pub struct PurgeChainCmd {
/// The base struct of the purge-chain command.
#[clap(flatten)]
#[command(flatten)]
pub base: sc_cli::PurgeChainCmd,
/// Only delete the para chain database
#[clap(long, aliases = &["para"])]
#[arg(long, aliases = &["para"])]
pub parachain: bool,
/// Only delete the relay chain database
#[clap(long, aliases = &["relay"])]
#[arg(long, aliases = &["relay"])]
pub relaychain: bool,
}
@@ -131,15 +132,15 @@ impl sc_cli::CliConfiguration for PurgeChainCmd {
#[derive(Debug, clap::Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[clap(action)]
#[arg()]
pub output: Option<PathBuf>,
/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
#[arg(short, long)]
pub raw: bool,
#[allow(missing_docs)]
#[clap(flatten)]
#[command(flatten)]
pub shared_params: sc_cli::SharedParams,
}
@@ -214,15 +215,15 @@ impl sc_cli::CliConfiguration for ExportGenesisStateCommand {
#[derive(Debug, clap::Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[clap(action)]
#[arg()]
pub output: Option<PathBuf>,
/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
#[arg(short, long)]
pub raw: bool,
#[allow(missing_docs)]
#[clap(flatten)]
#[command(flatten)]
pub shared_params: sc_cli::SharedParams,
}
@@ -277,19 +278,20 @@ fn validate_relay_chain_url(arg: &str) -> Result<Url, String> {
/// The `run` command used to run a node.
#[derive(Debug, clap::Parser)]
#[group(skip)]
pub struct RunCmd {
/// The cumulus RunCmd inherents from sc_cli's
#[clap(flatten)]
#[command(flatten)]
pub base: sc_cli::RunCmd,
/// Run node as collator.
///
/// Note that this is the same as running with `--validator`.
#[clap(long, conflicts_with = "validator")]
#[arg(long, conflicts_with = "validator")]
pub collator: bool,
/// EXPERIMENTAL: Specify an URL to a relay chain full node to communicate with.
#[clap(
#[arg(
long,
value_parser = validate_relay_chain_url
)]
+1 -1
View File
@@ -10,7 +10,7 @@ edition = "2021"
build = "build.rs"
[dependencies]
clap = { version = "3.2.22", features = ["derive"] }
clap = { version = "4.0.9", features = ["derive"] }
log = "0.4.17"
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.145", features = ["derive"] }
+6 -6
View File
@@ -32,7 +32,7 @@ pub enum Subcommand {
/// Sub-commands concerned with benchmarking.
/// The pallet benchmarking moved to the `pallet` sub-command.
#[clap(subcommand)]
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
/// Try some testing command against a specified runtime state.
@@ -40,16 +40,16 @@ pub enum Subcommand {
}
#[derive(Debug, clap::Parser)]
#[clap(
#[command(
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
)]
pub struct Cli {
#[clap(subcommand)]
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[clap(flatten)]
#[command(flatten)]
pub run: cumulus_client_cli::RunCmd,
/// Disable automatic hardware benchmarks.
@@ -59,11 +59,11 @@ pub struct Cli {
///
/// The results are then printed out in the logs, and also sent as part of
/// telemetry, if telemetry is enabled.
#[clap(long)]
#[arg(long)]
pub no_hardware_benchmarks: bool,
/// Relay chain arguments
#[clap(raw = true)]
#[arg(raw = true)]
pub relay_chain_args: Vec<String>,
}
+1 -1
View File
@@ -8,7 +8,7 @@ description = "Runs a polkadot parachain node which could be a collator."
[dependencies]
async-trait = "0.1.57"
clap = { version = "3.2.22", features = ["derive", "deprecated"] }
clap = { version = "4.0.9", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
futures = "0.3.24"
hex-literal = "0.3.4"
+7 -7
View File
@@ -20,7 +20,7 @@ use std::path::PathBuf;
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management CLI utilities
#[clap(subcommand)]
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
/// Build a chain specification.
@@ -52,7 +52,7 @@ pub enum Subcommand {
/// Sub-commands concerned with benchmarking.
/// The pallet benchmarking moved to the `pallet` sub-command.
#[clap(subcommand)]
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
/// Try some testing command against a specified runtime state.
@@ -60,16 +60,16 @@ pub enum Subcommand {
}
#[derive(Debug, clap::Parser)]
#[clap(
#[command(
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
)]
pub struct Cli {
#[clap(subcommand)]
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[clap(flatten)]
#[command(flatten)]
pub run: cumulus_client_cli::RunCmd,
/// Disable automatic hardware benchmarks.
@@ -79,11 +79,11 @@ pub struct Cli {
///
/// The results are then printed out in the logs, and also sent as part of
/// telemetry, if telemetry is enabled.
#[clap(long)]
#[arg(long)]
pub no_hardware_benchmarks: bool,
/// Relay chain arguments
#[clap(raw = true)]
#[arg(raw = true)]
pub relaychain_args: Vec<String>,
}
+1 -1
View File
@@ -10,7 +10,7 @@ path = "src/main.rs"
[dependencies]
async-trait = "0.1.57"
clap = { version = "3.2.22", features = ["derive", "deprecated"] }
clap = { version = "4.0.9", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
criterion = { version = "0.4.0", features = [ "async_tokio" ] }
jsonrpsee = { version = "0.15.1", features = ["server"] }
+13 -11
View File
@@ -24,30 +24,30 @@ use sc_cli::{
use sc_service::BasePath;
#[derive(Debug, clap::Parser)]
#[clap(
#[command(
version,
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
)]
pub struct TestCollatorCli {
#[clap(subcommand)]
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[clap(flatten)]
#[command(flatten)]
pub run: cumulus_client_cli::RunCmd,
#[clap(default_value_t = 2000u32)]
#[arg(default_value_t = 2000u32)]
pub parachain_id: u32,
/// Relay chain arguments
#[clap(raw = true)]
#[arg(raw = true)]
pub relaychain_args: Vec<String>,
#[clap(long)]
#[arg(long)]
pub use_null_consensus: bool,
#[clap(long)]
#[arg(long)]
pub disable_block_announcements: bool,
}
@@ -64,11 +64,12 @@ pub enum Subcommand {
}
#[derive(Debug, clap::Parser)]
#[group(skip)]
pub struct ExportGenesisStateCommand {
#[clap(default_value_t = 2000u32)]
#[arg(default_value_t = 2000u32)]
pub parachain_id: u32,
#[clap(flatten)]
#[command(flatten)]
pub base: cumulus_client_cli::ExportGenesisStateCommand,
}
@@ -80,11 +81,12 @@ impl CliConfiguration for ExportGenesisStateCommand {
/// Command for exporting the genesis wasm file.
#[derive(Debug, clap::Parser)]
#[group(skip)]
pub struct ExportGenesisWasmCommand {
#[clap(default_value_t = 2000u32)]
#[arg(default_value_t = 2000u32)]
pub parachain_id: u32,
#[clap(flatten)]
#[command(flatten)]
pub base: cumulus_client_cli::ExportGenesisWasmCommand,
}