soroban_cli/commands/keys/
default.rs1use clap::command;
2
3use crate::{commands::global, config::locator, print::Print};
4
5#[derive(thiserror::Error, Debug)]
6pub enum Error {
7 #[error(transparent)]
8 Config(#[from] locator::Error),
9}
10
11#[derive(Debug, clap::Parser, Clone)]
12#[group(skip)]
13pub struct Cmd {
14 pub name: String,
16
17 #[command(flatten)]
18 pub config_locator: locator::Args,
19}
20
21impl Cmd {
22 pub fn run(&self, global_args: &global::Args) -> Result<(), Error> {
23 let printer = Print::new(global_args.quiet);
24 let _ = self.config_locator.read_identity(&self.name)?;
25
26 self.config_locator.write_default_identity(&self.name)?;
27
28 printer.infoln(format!(
29 "The default source account is set to `{}`",
30 self.name,
31 ));
32
33 Ok(())
34 }
35}