From 02632cd888e2f1a1db0c48751abafc1a65cec290 Mon Sep 17 00:00:00 2001 From: Bjerg Date: Fri, 13 Jan 2023 15:01:59 +0100 Subject: [PATCH] feat: show possible values for `reth stage` (#872) --- Cargo.lock | 1 - bin/reth/Cargo.toml | 1 - bin/reth/src/stage/mod.rs | 11 +++-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e1c5ef60d..f6fdade268 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3617,7 +3617,6 @@ dependencies = [ "serde", "serde_json", "shellexpand", - "strum", "tempfile", "thiserror", "tokio", diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index faf7a2ed57..0aff9f0506 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -49,6 +49,5 @@ thiserror = "1.0" tokio = { version = "1.21", features = ["sync", "macros", "rt-multi-thread"] } tokio-stream = "0.1" futures = "0.3.25" -strum = "0.24.1" tempfile = { version = "3.3.0" } backon = "0.2.0" diff --git a/bin/reth/src/stage/mod.rs b/bin/reth/src/stage/mod.rs index b62e9cae61..31f8e2018d 100644 --- a/bin/reth/src/stage/mod.rs +++ b/bin/reth/src/stage/mod.rs @@ -20,10 +20,8 @@ use reth_stages::{ ExecInput, Stage, StageId, Transaction, UnwindInput, }; -use clap::Parser; -use serde::Deserialize; +use clap::{Parser, ValueEnum}; use std::{net::SocketAddr, sync::Arc}; -use strum::{AsRefStr, EnumString, EnumVariantNames}; use tracing::*; /// `reth stage` command @@ -67,6 +65,7 @@ pub struct Command { metrics: Option, /// The name of the stage to run + #[arg(value_enum)] stage: StageEnum, /// The height to start at @@ -89,11 +88,7 @@ pub struct Command { network: NetworkOpts, } -#[derive( - Debug, Clone, Copy, Eq, PartialEq, AsRefStr, EnumVariantNames, EnumString, Deserialize, -)] -#[serde(rename_all = "snake_case")] -#[strum(serialize_all = "kebab-case")] +#[derive(Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord, ValueEnum)] enum StageEnum { Headers, Bodies,