chore: add with ext function (#4087)

This commit is contained in:
Matthias Seitz
2023-08-06 14:14:26 +02:00
committed by GitHub
parent c423514321
commit aaf2d2cf19

View File

@@ -159,6 +159,40 @@ pub struct NodeCommand<Ext: RethCliExt = ()> {
}
impl<Ext: RethCliExt> NodeCommand<Ext> {
/// Replaces the extension of the node command
pub fn with_ext<E: RethCliExt>(self, ext: E::Node) -> NodeCommand<E> {
let Self {
datadir,
config,
chain,
metrics,
network,
rpc,
txpool,
builder,
debug,
db,
dev,
pruning,
..
} = self;
NodeCommand {
datadir,
config,
chain,
metrics,
network,
rpc,
txpool,
builder,
debug,
db,
dev,
pruning,
ext,
}
}
/// Execute `node` command
pub async fn execute(mut self, ctx: CliContext) -> eyre::Result<()> {
info!(target: "reth::cli", "reth {} starting", SHORT_VERSION);