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

Method run

atomic-cli/src/commands/project/delete.rs:65–113  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

63
64impl Command for ProjectDelete {
65 fn run(&self) -> CliResult<()> {
66 let rt = tokio::runtime::Runtime::new().map_err(|e| {
67 CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e))
68 })?;
69
70 rt.block_on(async {
71 let (ws_slug, proj_slug) = parse_project_path(&self.slug)?;
72
73 // Confirm deletion unless --force is specified.
74 if !self.force {
75 let prompt = format!(
76 "Delete project '{}' from workspace '{}'? This cannot be undone.",
77 proj_slug, ws_slug,
78 );
79
80 let confirmed = dialoguer::Confirm::new()
81 .with_prompt(&prompt)
82 .default(false)
83 .interact()
84 .map_err(|e| CliError::Internal(anyhow::anyhow!("Prompt failed: {}", e)))?;
85
86 if !confirmed {
87 return Err(CliError::Cancelled);
88 }
89 }
90
91 let client = build_client(self.org.as_deref(), None).await?;
92
93 client
94 .delete_project(ws_slug, proj_slug)
95 .await
96 .map_err(|e| {
97 if e.is_not_found() {
98 print_error(&format!(
99 "Project '{}' not found in workspace '{}'",
100 proj_slug, ws_slug,
101 ));
102 }
103 remote_err(e)
104 })?;
105
106 print_success(&format!(
107 "Deleted project {} from workspace {}",
108 proj_slug, ws_slug,
109 ));
110
111 Ok(())
112 })
113 }
114}
115
116#[cfg(test)]

Callers

nothing calls this directly

Calls 9

parse_project_pathFunction · 0.85
build_clientFunction · 0.85
print_errorFunction · 0.85
remote_errFunction · 0.85
print_successFunction · 0.85
with_promptMethod · 0.80
delete_projectMethod · 0.80
defaultMethod · 0.45
is_not_foundMethod · 0.45

Tested by

no test coverage detected