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

Method execute

atomic-cli/src/commands/org/update.rs:93–136  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

91
92impl OrgUpdate {
93 async fn execute(&self) -> CliResult<()> {
94 // At least one field must be provided to update.
95 if self.name.is_none() && self.email.is_none() {
96 return Err(CliError::InvalidArgument {
97 message: "At least one of --name or --email must be provided".to_string(),
98 });
99 }
100
101 let client = build_client(self.org.as_deref(), None).await?;
102
103 // Determine which slug to update: explicit arg > client's org slug.
104 let slug = self.slug.as_deref().unwrap_or_else(|| client.org_slug());
105
106 let info = atomic_teams::org::update_org(
107 &client,
108 slug,
109 self.name.as_deref(),
110 self.email.as_deref(),
111 )
112 .await
113 .map_err(|e| CliError::RemoteError {
114 message: e.to_string(),
115 url: None,
116 })?;
117
118 print_success(&format!("Updated organization: {}", info.slug));
119 println!();
120
121 let table = KeyValueTable::new()
122 .add("Name", &info.name)
123 .add("Slug", &info.slug)
124 .add("Kind", &info.kind)
125 .add("Plan", &info.plan);
126 let table = if let Some(email) = &info.email {
127 table.add("Email", email)
128 } else {
129 table
130 };
131 let table = table.add("ID", info.id.to_string());
132
133 println!("{table}");
134
135 Ok(())
136 }
137}
138
139#[cfg(test)]

Callers 1

runMethod · 0.45

Calls 6

build_clientFunction · 0.85
update_orgFunction · 0.85
print_successFunction · 0.85
is_noneMethod · 0.80
org_slugMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected