mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 07:25:44 +00:00
Update clap to version 4 (#6128)
* Move clap to 4.0.9
* Remove "deprecated" feature flag
* Convert to default_value_t
* update lockfile for {"substrate"}
* Add group(skip) to avoid naming conflict
* More group(skip)
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -21,21 +21,21 @@ use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[clap(author, version, about)]
|
||||
#[command(author, version, about)]
|
||||
pub(crate) struct Opt {
|
||||
/// The `ws` node to connect to.
|
||||
#[clap(long, short, default_value = DEFAULT_URI, env = "URI", global = true)]
|
||||
#[arg(long, short, default_value = DEFAULT_URI, env = "URI", global = true)]
|
||||
pub uri: String,
|
||||
|
||||
/// WS connection timeout in number of seconds.
|
||||
#[clap(long, parse(try_from_str), default_value_t = 60)]
|
||||
#[arg(long, default_value_t = 60)]
|
||||
pub connection_timeout: usize,
|
||||
|
||||
/// WS request timeout in number of seconds.
|
||||
#[clap(long, parse(try_from_str), default_value_t = 60 * 10)]
|
||||
#[arg(long, default_value_t = 60 * 10)]
|
||||
pub request_timeout: usize,
|
||||
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub command: Command,
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ pub(crate) struct MonitorConfig {
|
||||
///
|
||||
/// WARNING: Don't use an account with a large stash for this. Based on how the bot is
|
||||
/// configured, it might re-try and lose funds through transaction fees/deposits.
|
||||
#[clap(long, short, env = "SEED")]
|
||||
#[arg(long, short, env = "SEED")]
|
||||
pub seed_or_path: String,
|
||||
|
||||
/// They type of event to listen to.
|
||||
@@ -73,11 +73,11 @@ pub(crate) struct MonitorConfig {
|
||||
/// Typically, finalized is safer and there is no chance of anything going wrong, but it can be
|
||||
/// slower. It is recommended to use finalized, if the duration of the signed phase is longer
|
||||
/// than the the finality delay.
|
||||
#[clap(long, default_value = "head", possible_values = &["head", "finalized"])]
|
||||
#[arg(long, default_value = "head", value_parser = ["head", "finalized"])]
|
||||
pub listen: String,
|
||||
|
||||
/// The solver algorithm to use.
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub solver: Solver,
|
||||
|
||||
/// Submission strategy to use.
|
||||
@@ -89,7 +89,7 @@ pub(crate) struct MonitorConfig {
|
||||
/// `--submission-strategy always`: always submit.
|
||||
///
|
||||
/// `--submission-strategy "percent-better <percent>"`: submit if the submission is `n` percent better.
|
||||
#[clap(long, parse(try_from_str), default_value = "if-leading")]
|
||||
#[arg(long, default_value = "if-leading")]
|
||||
pub submission_strategy: SubmissionStrategy,
|
||||
|
||||
/// Delay in number seconds to wait until starting mining a solution.
|
||||
@@ -100,7 +100,7 @@ pub(crate) struct MonitorConfig {
|
||||
///
|
||||
/// When this is enabled and there are competing solutions, your solution might not be submitted
|
||||
/// if the scores are equal.
|
||||
#[clap(long, parse(try_from_str), default_value_t = 0)]
|
||||
#[arg(long, default_value_t = 0)]
|
||||
pub delay: usize,
|
||||
}
|
||||
|
||||
@@ -114,19 +114,19 @@ pub(crate) struct DryRunConfig {
|
||||
///
|
||||
/// WARNING: Don't use an account with a large stash for this. Based on how the bot is
|
||||
/// configured, it might re-try and lose funds through transaction fees/deposits.
|
||||
#[clap(long, short, env = "SEED")]
|
||||
#[arg(long, short, env = "SEED")]
|
||||
pub seed_or_path: String,
|
||||
|
||||
/// The block hash at which scraping happens. If none is provided, the latest head is used.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub at: Option<Hash>,
|
||||
|
||||
/// The solver algorithm to use.
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub solver: Solver,
|
||||
|
||||
/// Force create a new snapshot, else expect one to exist onchain.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub force_snapshot: bool,
|
||||
}
|
||||
|
||||
@@ -134,11 +134,11 @@ pub(crate) struct DryRunConfig {
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub(crate) struct EmergencySolutionConfig {
|
||||
/// The block hash at which scraping happens. If none is provided, the latest head is used.
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub at: Option<Hash>,
|
||||
|
||||
/// The solver algorithm to use.
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub solver: Solver,
|
||||
|
||||
/// The number of top backed winners to take. All are taken, if not provided.
|
||||
@@ -149,7 +149,7 @@ pub(crate) struct EmergencySolutionConfig {
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub(crate) struct InfoOpts {
|
||||
/// Serialize the output as json
|
||||
#[clap(long, short)]
|
||||
#[arg(long, short)]
|
||||
pub json: bool,
|
||||
}
|
||||
|
||||
@@ -170,11 +170,11 @@ pub enum SubmissionStrategy {
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
pub(crate) enum Solver {
|
||||
SeqPhragmen {
|
||||
#[clap(long, default_value = "10")]
|
||||
#[arg(long, default_value_t = 10)]
|
||||
iterations: usize,
|
||||
},
|
||||
PhragMMS {
|
||||
#[clap(long, default_value = "10")]
|
||||
#[arg(long, default_value_t = 10)]
|
||||
iterations: usize,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user