Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/cli/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ repository.workspace = true
[dependencies]
# reth
reth-cli-runner.workspace = true
reth-chainspec.workspace = true
eyre.workspace = true

# misc
clap.workspace = true
25 changes: 25 additions & 0 deletions crates/cli/cli/src/chainspec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use clap::builder::TypedValueParser;
use reth_chainspec::ChainSpec;
use std::sync::Arc;

/// Trait for parsing chain specifications.
///
/// This trait extends [`clap::builder::TypedValueParser`] to provide a parser for chain
/// specifications. Implementors of this trait must provide a list of supported chains and a
Comment thread
mattsse marked this conversation as resolved.
Outdated
/// function to parse a given string into a [`ChainSpec`].
pub trait ChainSpecParser: TypedValueParser<Value = Arc<ChainSpec>> + Default {
/// List of supported chains.
const SUPPORTED_CHAINS: &'static [&'static str];

/// Parses the given string into a [`ChainSpec`].
///
/// # Arguments
///
/// * `s` - A string slice that holds the chain spec to be parsed.
///
/// # Errors
///
/// This function will return an error if the input string cannot be parsed into a valid
/// [`ChainSpec`].
fn parse(&self, s: &str) -> eyre::Result<Arc<ChainSpec>>;
}
2 changes: 2 additions & 0 deletions crates/cli/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use reth_cli_runner::CliRunner;

use clap::{Error, Parser};

pub mod chainspec;

/// Reth based node cli.
///
/// This trait is supposed to be implemented by the main struct of the CLI.
Expand Down