Skip to content

Commit

Permalink
fix: clap enum default value
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5ea000000 committed Sep 9, 2024
1 parent 9f500c4 commit 9c6c8b8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions crates/node/src/cli/l1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,19 @@ fn parse_url(s: &str) -> Result<Url, url::ParseError> {
}

#[derive(Clone, Debug, clap::ValueEnum, PartialEq)]
#[value(rename_all = "kebab-case")]
pub enum L1Type {
Ethereum,
Aptos
}

impl Display for L1Type {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
L1Type::Ethereum => write!(f, "ethereum"),
L1Type::Aptos => write!(f, "aptos"),
}
}
}

#[derive(Clone, Debug, clap::Args)]
pub struct L1SyncParams {
/// Disable L1 sync.
#[clap(long, alias = "no-l1-sync", conflicts_with = "l1_endpoint")]
pub sync_l1_disabled: bool,

#[clap(long, value_name = "L1 TYPE", default_value_t = L1Type::Ethereum, required_unless_present = "sync_l1_disabled")]
#[clap(value_enum, default_value_t = L1Type::Ethereum, required_unless_present = "sync_l1_disabled")]
pub l1_type: L1Type,

/// The L1 rpc endpoint url for state verification.
Expand Down

0 comments on commit 9c6c8b8

Please sign in to comment.