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

Method run

atomic-cli/src/commands/workspace/update.rs:68–108  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

66
67impl Command for WorkspaceUpdate {
68 fn run(&self) -> CliResult<()> {
69 // Validate that at least one field is being updated.
70 if self.name.is_none() && self.description.is_none() && self.visibility.is_none() {
71 return Err(CliError::InvalidArgument {
72 message: "At least one of --name, --description, or --visibility is required."
73 .to_string(),
74 });
75 }
76
77 let rt = tokio::runtime::Runtime::new().map_err(|e| {
78 CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e))
79 })?;
80
81 rt.block_on(async {
82 let client = build_client(self.org.as_deref(), None).await?;
83
84 let req = UpdateWorkspaceRequest {
85 name: self.name.clone(),
86 description: self.description.clone(),
87 visibility: self.visibility,
88 };
89
90 let ws = client
91 .update_workspace(&self.slug, &req)
92 .await
93 .map_err(remote_err)?;
94
95 print_success(&format!("Updated workspace: {}", ws.slug));
96 println!();
97
98 let table = KeyValueTable::new()
99 .add("Name", &ws.name)
100 .add("Slug", &ws.slug)
101 .add("Visibility", ws.visibility.to_string())
102 .add("Description", ws.description.as_deref().unwrap_or("—"));
103
104 println!("{}", table);
105
106 Ok(())
107 })
108 }
109}
110
111#[cfg(test)]

Callers 1

rejects_no_update_fieldsFunction · 0.45

Calls 6

build_clientFunction · 0.85
print_successFunction · 0.85
is_noneMethod · 0.80
update_workspaceMethod · 0.80
cloneMethod · 0.45
addMethod · 0.45

Tested by 1

rejects_no_update_fieldsFunction · 0.36