soroban_cli/commands/network/
add.rs

1use crate::config::{locator, network, secret};
2use clap::command;
3
4#[derive(thiserror::Error, Debug)]
5pub enum Error {
6    #[error(transparent)]
7    Secret(#[from] secret::Error),
8
9    #[error(transparent)]
10    Config(#[from] locator::Error),
11}
12
13#[derive(Debug, clap::Parser, Clone)]
14#[group(skip)]
15pub struct Cmd {
16    /// Name of network
17    pub name: String,
18
19    #[command(flatten)]
20    pub network: network::Network,
21
22    #[command(flatten)]
23    pub config_locator: locator::Args,
24}
25
26impl Cmd {
27    pub fn run(&self) -> Result<(), Error> {
28        self.config_locator
29            .write_network(&self.name, &self.network)?;
30        Ok(())
31    }
32}