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

Bump clap from 3.1.18 to 3.2.2 #1370

Merged
merged 2 commits into from
Jun 17, 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
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 <[email protected]>"]
edition = "2021"

[dependencies]
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.2.5", features = ["derive", "deprecated"] }

# Substrate
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
7 changes: 3 additions & 4 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ impl sc_cli::CliConfiguration for PurgeChainCmd {
}
}

fn validate_relay_chain_url(arg: &str) -> Result<(), String> {
fn validate_relay_chain_url(arg: &str) -> Result<Url, String> {
let url = Url::parse(arg).map_err(|e| e.to_string())?;

if url.scheme() == "ws" {
Ok(())
Ok(url)
} else {
Err(format!(
"'{}' URL scheme not supported. Only websocket RPC is currently supported",
Expand All @@ -148,8 +148,7 @@ pub struct RunCmd {
/// EXPERIMENTAL: Specify an URL to a relay chain full node to communicate with.
#[clap(
long,
parse(try_from_str),
validator = validate_relay_chain_url,
value_parser = validate_relay_chain_url,
conflicts_with_all = &["alice", "bob", "charlie", "dave", "eve", "ferdie", "one", "two"] )
]
pub relay_chain_rpc_url: Option<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 @@ -14,7 +14,7 @@ name = "parachain-collator"
path = "src/main.rs"

[dependencies]
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.2.5", features = ["derive"] }
derive_more = "0.99.2"
log = "0.4.17"
codec = { package = "parity-scale-codec", version = "3.0.0" }
Expand Down
8 changes: 4 additions & 4 deletions parachain-template/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub enum Subcommand {
#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
Expand All @@ -63,15 +63,15 @@ pub struct ExportGenesisStateCommand {
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
#[clap(short, long, action)]
pub raw: bool,

/// The name of the chain for that the genesis wasm file should be exported.
#[clap(long)]
#[clap(long, action)]
pub chain: Option<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 @@ -12,7 +12,7 @@ path = "src/main.rs"

[dependencies]
async-trait = "0.1.56"
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.2.5", features = ["derive", "deprecated"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
futures = { version = "0.3.1", features = ["compat"] }
hex-literal = "0.3.4"
Expand Down
4 changes: 2 additions & 2 deletions polkadot-parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum Subcommand {
#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
Expand All @@ -84,7 +84,7 @@ pub struct ExportGenesisStateCommand {
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
Expand Down
2 changes: 1 addition & 1 deletion test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "mast
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-test-client = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.2.5", features = ["derive", "deprecated"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need deprecated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also added the "deprecated" feature to clap so no cli options will be added in the old style anymore.

Now I read this.

But what does that mean?

Copy link
Contributor

@skunert skunert Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So clap authors deprecated some of their derive API to streamline their API for the upcoming 4.0 release. However, the deprecation messaged did not make it obvious how to migrate. So after user feedback in clap-rs/clap#3822, they hid the deprecation messages behind feature flag "deprecated".

However, since I have already adopted the new API now, we want the deprecation messages for the old style so no one will go back.

tracing = "0.1.25"

# Polkadot
Expand Down
14 changes: 7 additions & 7 deletions test/service/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,34 @@ pub struct ExportGenesisStateCommand {
pub parachain_id: u32,

/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
#[clap(short, long, action)]
pub raw: bool,

/// The name of the chain for that the genesis state should be exported.
#[clap(long)]
#[clap(long, action)]
pub chain: Option<String>,
}

/// Command for exporting the genesis wasm file.
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
#[clap(default_value_t = 2000u32)]
#[clap(default_value_t = 2000u32, action)]
pub parachain_id: u32,

/// Output file name or stdout if unspecified.
#[clap(parse(from_os_str))]
#[clap(action)]
pub output: Option<PathBuf>,

/// Write output in binary. Default is to write in hex.
#[clap(short, long)]
#[clap(short, long, action)]
pub raw: bool,

/// The name of the chain for that the genesis wasm file should be exported.
#[clap(long)]
#[clap(long, action)]
pub chain: Option<String>,
}
#[derive(Subcommand, Debug)]
Expand Down