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

Method execute

atomic-cli/src/commands/team/create.rs:104–166  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

102
103impl TeamCreate {
104 async fn execute(&self) -> CliResult<()> {
105 // Parse visibility if provided.
106 let visibility = self
107 .visibility
108 .as_deref()
109 .map(|v| {
110 v.parse::<TeamVisibility>()
111 .map_err(|_| CliError::InvalidArgument {
112 message: format!(
113 "Invalid visibility '{}'. Valid values: visible, secret",
114 v
115 ),
116 })
117 })
118 .transpose()?;
119
120 let client = build_client(self.org.as_deref(), None).await?;
121 let org_slug = client.org_slug().to_string();
122
123 let info = atomic_teams::team::create_team(
124 &client,
125 &org_slug,
126 &self.name,
127 self.description.as_deref(),
128 visibility,
129 )
130 .await
131 .map_err(|e| CliError::RemoteError {
132 message: e.to_string(),
133 url: None,
134 })?;
135
136 print_success(&format!("Created team: {}", info.slug));
137 println!();
138
139 let table = KeyValueTable::new()
140 .add("Name", &info.name)
141 .add("Slug", &info.slug)
142 .add("Visibility", info.visibility.to_string());
143 let table = if let Some(desc) = &info.description {
144 table.add("Description", desc)
145 } else {
146 table
147 };
148 let table = table
149 .add("Organization", &org_slug)
150 .add("ID", info.id.to_string());
151
152 println!("{table}");
153
154 print_next_steps(&[
155 (
156 &format!("atomic team member add {} <id>", info.slug),
157 "Add members to the team",
158 ),
159 (
160 &format!("atomic team show {}", info.slug),
161 "View team details",

Callers 1

runMethod · 0.45

Calls 6

build_clientFunction · 0.85
create_teamFunction · 0.85
print_successFunction · 0.85
print_next_stepsFunction · 0.85
org_slugMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected