soroban_cli/commands/network/
add.rs

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