Resolve the org slug for callers that don't already hold a server config. Loads global config, resolves the active server profile, and delegates to [`resolve_org_with_server`] so the identity-personal-org fallback applies consistently.
(org_override: Option<&str>)
| 278 | /// [`resolve_org_with_server`] so the identity-personal-org fallback applies |
| 279 | /// consistently. |
| 280 | pub fn resolve_org(org_override: Option<&str>) -> CliResult<String> { |
| 281 | if let Some(s) = org_override { |
| 282 | if s.is_empty() { |
| 283 | return Err(CliError::InvalidArgument { |
| 284 | message: "Organization slug cannot be empty.".to_string(), |
| 285 | }); |
| 286 | } |
| 287 | return Ok(s.to_string()); |
| 288 | } |
| 289 | |
| 290 | let config = GlobalConfig::load() |
| 291 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to load global config: {}", e)))?; |
| 292 | |
| 293 | let (server, _name) = config |
| 294 | .resolve_server(None) |
| 295 | .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?; |
| 296 | |
| 297 | resolve_org_with_server(None, server) |
| 298 | } |
| 299 | |
| 300 | /// Resolve the workspace slug for a command, with fallback to the |
| 301 | /// org-scoped default workspace from a server config. |