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

Method execute_with_client

atomic-cli/src/commands/project/delete.rs:89–128  ·  view source on GitHub ↗
(
        &self,
        client: &StorageClient,
        ws_slug: &str,
        proj_slug: &str,
        confirm: F,
    )

Source from the content-addressed store, hash-verified

87
88impl ProjectDelete {
89 async fn execute_with_client<F>(
90 &self,
91 client: &StorageClient,
92 ws_slug: &str,
93 proj_slug: &str,
94 confirm: F,
95 ) -> CliResult<()>
96 where
97 F: FnOnce(&str) -> CliResult<bool>,
98 {
99 // Interactive deletes validate the target before asking the user to
100 // confirm. Forced deletes keep the single-request path for scripts.
101 if !self.force {
102 client
103 .get_project(ws_slug, proj_slug)
104 .await
105 .map_err(|e| map_project_error(e, ws_slug, proj_slug))?;
106
107 let prompt = format!(
108 "Delete project '{}' from workspace '{}'? This cannot be undone.",
109 proj_slug, ws_slug,
110 );
111
112 if !confirm(&prompt)? {
113 return Err(CliError::Cancelled);
114 }
115 }
116
117 client
118 .delete_project(ws_slug, proj_slug)
119 .await
120 .map_err(|e| map_project_error(e, ws_slug, proj_slug))?;
121
122 print_success(&format!(
123 "Deleted project {} from workspace {}",
124 proj_slug, ws_slug,
125 ));
126
127 Ok(())
128 }
129}
130
131fn map_project_error(

Callers 2

runMethod · 0.80

Calls 4

map_project_errorFunction · 0.85
print_successFunction · 0.85
get_projectMethod · 0.80
delete_projectMethod · 0.80

Tested by

no test coverage detected