reth_cli_commands/
config_cmd.rsuse std::path::PathBuf;
use clap::Parser;
use eyre::{bail, WrapErr};
use reth_config::Config;
#[derive(Debug, Parser)]
pub struct Command {
#[arg(long, value_name = "FILE", verbatim_doc_comment)]
config: Option<PathBuf>,
#[arg(long, verbatim_doc_comment, conflicts_with = "config")]
default: bool,
}
impl Command {
pub async fn execute(&self) -> eyre::Result<()> {
let config = if self.default {
Config::default()
} else {
let path = self.config.clone().unwrap_or_default();
if !path.exists() {
bail!("Config file does not exist: {}", path.display());
}
Config::from_path(&path)
.wrap_err_with(|| format!("Could not load config file: {}", path.display()))?
};
println!("{}", toml::to_string_pretty(&config)?);
Ok(())
}
}