(&self)
| 64 | |
| 65 | impl Command for WorkspaceShow { |
| 66 | fn run(&self) -> CliResult<()> { |
| 67 | let rt = tokio::runtime::Runtime::new() |
| 68 | .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?; |
| 69 | |
| 70 | rt.block_on(async { |
| 71 | let client = build_client(self.org.as_deref(), None).await?; |
| 72 | let ws = client.get_workspace(&self.slug).await.map_err(remote_err)?; |
| 73 | |
| 74 | if self.format == "json" { |
| 75 | println!("{}", serde_json::to_string_pretty(&ws).unwrap_or_default()); |
| 76 | return Ok(()); |
| 77 | } |
| 78 | |
| 79 | let description = ws.description.as_deref().unwrap_or("—").to_string(); |
| 80 | |
| 81 | let table = KeyValueTable::new() |
| 82 | .add("Name", &ws.name) |
| 83 | .add("Slug", &ws.slug) |
| 84 | .add("Visibility", ws.visibility.to_string()) |
| 85 | .add("Description", &description) |
| 86 | .add("Owner ID", ws.owner_id.to_string()) |
| 87 | .add("Created", format_timestamp(&ws.created_at)) |
| 88 | .add("Updated", format_timestamp(&ws.updated_at)); |
| 89 | |
| 90 | println!("{}", table); |
| 91 | |
| 92 | Ok(()) |
| 93 | }) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | #[cfg(test)] |
nothing calls this directly
no test coverage detected