(&self)
| 102 | |
| 103 | impl 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", |
no test coverage detected