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