MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / execute

Method execute

atomic-cli/src/commands/team/delete.rs:87–129  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

85
86impl TeamDelete {
87 async fn execute(&self) -> CliResult<()> {
88 let client = build_client(self.org.as_deref(), None).await?;
89 let org_slug = client.org_slug().to_string();
90
91 // `--force` skips both the precheck and confirmation.
92 if !self.force {
93 // Check that the team exists before prompting.
94 atomic_teams::team::get_team(&client, &org_slug, &self.slug)
95 .await
96 .map_err(|e| CliError::RemoteError {
97 message: e.to_string(),
98 url: None,
99 })?;
100
101 print_warning(&format!(
102 "This will permanently delete team '{}' and all its memberships and grants.",
103 self.slug
104 ));
105
106 let confirmed = dialoguer::Confirm::new()
107 .with_prompt("Are you sure?")
108 .default(false)
109 .interact()
110 .map_err(|e| {
111 CliError::Internal(anyhow::anyhow!("Failed to read confirmation: {e}"))
112 })?;
113
114 if !confirmed {
115 return Err(CliError::Cancelled);
116 }
117 }
118
119 atomic_teams::team::delete_team(&client, &org_slug, &self.slug)
120 .await
121 .map_err(|e| CliError::RemoteError {
122 message: e.to_string(),
123 url: None,
124 })?;
125
126 print_success(&format!("Deleted team: {}", self.slug));
127
128 Ok(())
129 }
130}
131
132#[cfg(test)]

Callers 1

runMethod · 0.45

Calls 8

build_clientFunction · 0.85
get_teamFunction · 0.85
print_warningFunction · 0.85
delete_teamFunction · 0.85
print_successFunction · 0.85
org_slugMethod · 0.80
with_promptMethod · 0.80
defaultMethod · 0.45

Tested by

no test coverage detected