mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
Bump clap to 4.0.x and adjust to best practices (#12381)
* Bump clap to 3.2.22 * Replace `from_os_str` with `value_parser` * Replace `from_str` and `try_from_str` with `value_parser` * Move possible_values to the new format * Remove unwanted print * Add missing match branch * Update clap to 4.0.9 and make it compile * Replace deprecated `clap` macro with `command` and `value` * Move remaining `clap` attributes to `arg` * Remove no-op value_parsers * Adjust value_parser for state_version * Remove "deprecated" feature flag and bump to 4.0.11 * Improve range Co-authored-by: Bastian Köcher <git@kchr.de> * Apply suggestions * Trigger CI * Fix unused error warning * Fix doc errors * Fix ArgGroup naming conflict * Change default_value to default_value_t * Use 1.. instead of 0.. Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -46,7 +46,7 @@ pub struct NodeKeyParams {
|
||||
/// WARNING: Secrets provided as command-line arguments are easily exposed.
|
||||
/// Use of this option should be limited to development and testing. To use
|
||||
/// an externally managed secret key, use `--node-key-file` instead.
|
||||
#[clap(long, value_name = "KEY")]
|
||||
#[arg(long, value_name = "KEY")]
|
||||
pub node_key: Option<String>,
|
||||
|
||||
/// The type of secret key to use for libp2p networking.
|
||||
@@ -66,7 +66,7 @@ pub struct NodeKeyParams {
|
||||
///
|
||||
/// The node's secret key determines the corresponding public key and hence the
|
||||
/// node's peer ID in the context of libp2p.
|
||||
#[clap(long, value_name = "TYPE", arg_enum, ignore_case = true, default_value = "ed25519")]
|
||||
#[arg(long, value_name = "TYPE", value_enum, ignore_case = true, default_value_t = NodeKeyType::Ed25519)]
|
||||
pub node_key_type: NodeKeyType,
|
||||
|
||||
/// The file from which to read the node's secret key to use for libp2p networking.
|
||||
@@ -79,7 +79,7 @@ pub struct NodeKeyParams {
|
||||
///
|
||||
/// If the file does not exist, it is created with a newly generated secret key of
|
||||
/// the chosen type.
|
||||
#[clap(long, value_name = "FILE")]
|
||||
#[arg(long, value_name = "FILE")]
|
||||
pub node_key_file: Option<PathBuf>,
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ fn parse_ed25519_secret(hex: &str) -> error::Result<sc_network::config::Ed25519S
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use clap::ArgEnum;
|
||||
use clap::ValueEnum;
|
||||
use sc_network::config::identity::{ed25519, Keypair};
|
||||
use std::fs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user