gitprofile/commands/
remove.rs1use anyhow::{Result, bail};
2
3use crate::context::AppContext;
4
5pub fn execute(context: &AppContext, profile_key: &str) -> Result<()> {
6 let config = context.config_client.load()?;
7
8 if !config.has_profile_key(&profile_key) {
9 bail!("Profile {} doesn't exist", &profile_key);
10 }
11
12 let mut config = config;
13 config.remove_profile(&profile_key);
14 let config = config;
15
16 context.config_client.save(&config)?;
17
18 println!("✨ Successfully removed {}", profile_key);
19 Ok(())
20}