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>)
| 351 | /// [`resolve_org_with_server`] so the identity-personal-org fallback applies |
| 352 | /// consistently. |
| 353 | pub fn resolve_org(org_override: Option<&str>) -> CliResult<String> { |
| 354 | if let Some(s) = org_override { |
| 355 | if s.is_empty() { |
| 356 | return Err(CliError::InvalidArgument { |
| 357 | message: "Organization slug cannot be empty.".to_string(), |
| 358 | }); |
| 359 | } |
| 360 | return Ok(s.to_string()); |
| 361 | } |
| 362 | |
| 363 | let config = GlobalConfig::load() |
| 364 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to load global config: {}", e)))?; |
| 365 | |
| 366 | let (server, _name) = config |
| 367 | .resolve_server(None) |
| 368 | .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?; |
| 369 | |
| 370 | resolve_org_with_server(None, server) |
| 371 | } |
| 372 | |
| 373 | /// Resolve the workspace slug for a command, with fallback to the |
| 374 | /// org-scoped default workspace from a server config. |