Files
nym/mixnode/src/commands/node_details.rs
T
Jędrzej Stuczyński 1347535e8f mixnode: ibid
2023-04-04 10:26:41 +01:00

35 lines
919 B
Rust

// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::config::Config;
use crate::node::MixNode;
use clap::Args;
use nym_bin_common::output_format::OutputFormat;
use nym_config::NymConfig;
#[derive(Args)]
pub(crate) struct NodeDetails {
/// The id of the mixnode you want to show details for
#[clap(long)]
id: String,
#[clap(short, long, default_value_t = OutputFormat::default())]
output: OutputFormat,
}
pub(crate) fn execute(args: &NodeDetails) {
let config = match Config::load_from_file(&args.id) {
Ok(cfg) => cfg,
Err(err) => {
error!(
"Failed to load config for {}. Are you sure you have run `init` before? (Error was: {})",
args.id,
err,
);
return;
}
};
MixNode::new(config).print_node_details(args.output)
}