Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Update clap to version 4 #1745

Merged
merged 10 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,102 changes: 407 additions & 695 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
26 changes: 14 additions & 12 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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
)]
Expand Down
2 changes: 1 addition & 1 deletion parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
12 changes: 6 additions & 6 deletions parachain-template/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ 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.
TryRuntime(try_runtime_cli::TryRuntimeCmd),
}

#[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.
Expand All @@ -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>,
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions polkadot-parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -52,24 +52,24 @@ 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.
TryRuntime(try_runtime_cli::TryRuntimeCmd),
}

#[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.
Expand All @@ -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>,
}

Expand Down
2 changes: 1 addition & 1 deletion test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
24 changes: 13 additions & 11 deletions test/service/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -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,
}

Expand All @@ -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,
}

Expand Down