Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): fix clap deprecated warnings #6872

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub use crate::core::cli::*;
#[command(author, version = SHORT_VERSION, long_version = LONG_VERSION, about = "Reth", long_about = None)]
pub struct Cli<Ext: RethCliExt = ()> {
/// The command to run
#[clap(subcommand)]
#[command(subcommand)]
command: Commands<Ext>,

/// The chain this node is running.
Expand Down Expand Up @@ -64,7 +64,7 @@ pub struct Cli<Ext: RethCliExt = ()> {
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
instance: u16,

#[clap(flatten)]
#[command(flatten)]
logs: LogArgs,
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct Command {
secondary_datadir: PlatformPath<DataDirPath>,

/// Arguments for the second database
#[clap(flatten)]
#[command(flatten)]
second_db: DatabaseArgs,

/// The table name to diff. If not specified, all tables are diffed.
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/db/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct Command {
pub subkey: Option<String>,

/// Output bytes instead of human-readable decoded value
#[clap(long)]
#[arg(long)]
pub raw: bool,
}

Expand Down Expand Up @@ -121,7 +121,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct Command {
chain: Arc<ChainSpec>,

/// Database arguments.
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

/// Overrides the KZG trusted setup by reading from the supplied file.
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

/// The maximum block height.
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/in_memory_merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,

/// The number of retries per request
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,

/// The number of retries per request
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod replay_engine;
/// `reth debug` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/debug_cmd/replay_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,

/// The path to read engine API messages from.
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct ImportCommand {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

/// The path to a block file for import.
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/init_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct InitCommand {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
}

Expand Down
21 changes: 10 additions & 11 deletions bin/reth/src/commands/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,45 +85,44 @@ pub struct NodeCommand<Ext: RethCliExt = ()> {
pub trusted_setup_file: Option<PathBuf>,

/// All networking related arguments
#[clap(flatten)]
#[command(flatten)]
pub network: NetworkArgs,

/// All rpc related arguments
#[clap(flatten)]
#[command(flatten)]
pub rpc: RpcServerArgs,

/// All txpool related arguments with --txpool prefix
#[clap(flatten)]
#[command(flatten)]
pub txpool: TxPoolArgs,

/// All payload builder related arguments
#[clap(flatten)]
#[command(flatten)]
pub builder: PayloadBuilderArgs,

/// All debug related arguments with --debug prefix
#[clap(flatten)]
#[command(flatten)]
pub debug: DebugArgs,

/// All database related arguments
#[clap(flatten)]
#[command(flatten)]
pub db: DatabaseArgs,

/// All dev related arguments with --dev prefix
#[clap(flatten)]
#[command(flatten)]
pub dev: DevArgs,

/// All pruning related arguments
#[clap(flatten)]
#[command(flatten)]
pub pruning: PruningArgs,

/// Rollup related arguments
#[cfg(feature = "optimism")]
#[clap(flatten)]
#[command(flatten)]
pub rollup: crate::args::RollupArgs,

/// Additional cli arguments
#[clap(flatten)]
#[clap(next_help_heading = "Extension")]
#[command(flatten, next_help_heading = "Extension")]
pub ext: Ext::Node,
}

Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/p2p/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ pub struct Command {
#[arg(long, default_value = "any")]
nat: NatResolver,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/recover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod storage_tries;
/// `reth recover` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

stage: StageEnum,
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/stage/dump/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(subcommand)]
#[command(subcommand)]
command: Stages,
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod unwind;
/// `reth stage` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/commands/stage/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct Command {
/// Enable Prometheus metrics.
///
/// The metrics will be served at the given interface and port.
#[clap(long, value_name = "SOCKET")]
#[arg(long, value_name = "SOCKET")]
metrics: Option<SocketAddr>,

/// The name of the stage to run
Expand All @@ -90,10 +90,10 @@ pub struct Command {
#[arg(long, short)]
skip_unwind: bool,

#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

/// Commits the changes in the database. WARNING: potentially destructive.
Expand Down
8 changes: 4 additions & 4 deletions bin/reth/src/commands/stage/unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,

#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,

#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down Expand Up @@ -87,10 +87,10 @@ impl Command {
#[derive(Subcommand, Debug, Eq, PartialEq)]
enum Subcommands {
/// Unwinds the database until the given block number (range is inclusive).
#[clap(name = "to-block")]
#[command(name = "to-block")]
ToBlock { target: BlockHashOrNumber },
/// Unwinds the given number of blocks from the database.
#[clap(name = "num-blocks")]
#[command(name = "num-blocks")]
NumBlocks { amount: u64 },
}

Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/test_vectors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod tables;
/// Generate test-vectors for different data types.
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/node-core/src/args/database_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use reth_interfaces::db::LogLevel;

/// Parameters for database configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[clap(next_help_heading = "Database")]
#[command(next_help_heading = "Database")]
pub struct DatabaseArgs {
/// Database logging level. Levels higher than "notice" require a debug build.
#[arg(long = "db.log-level", value_enum)]
Expand All @@ -20,7 +20,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/node-core/src/args/debug_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;

/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq, Default)]
#[clap(next_help_heading = "Debug")]
#[command(next_help_heading = "Debug")]
pub struct DebugArgs {
/// Prompt the downloader to download blocks one at a time.
///
Expand Down Expand Up @@ -74,7 +74,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/node-core/src/args/dev_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use humantime::parse_duration;

/// Parameters for Dev testnet configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[clap(next_help_heading = "Dev testnet")]
#[command(next_help_heading = "Dev testnet")]
pub struct DevArgs {
/// Start the node in dev mode
///
Expand Down Expand Up @@ -49,7 +49,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

Expand Down
4 changes: 2 additions & 2 deletions crates/node-core/src/args/gas_price_oracle_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use reth_rpc_builder::constants::{

/// Parameters to configure Gas Price Oracle
#[derive(Debug, Clone, Copy, Args, PartialEq, Eq)]
#[clap(next_help_heading = "Gas Price Oracle")]
#[command(next_help_heading = "Gas Price Oracle")]
pub struct GasPriceOracleArgs {
/// Number of recent blocks to check for gas price
#[arg(long = "gpo.blocks", default_value_t = DEFAULT_GAS_PRICE_BLOCKS)]
Expand Down Expand Up @@ -59,7 +59,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

Expand Down
Loading
Loading