Resolve the org slug using the legacy (single-server) config path. Kept for callers that don't yet pass a server override.
(org_override: Option<&str>)
| 177 | /// |
| 178 | /// Kept for callers that don't yet pass a server override. |
| 179 | pub fn resolve_org(org_override: Option<&str>) -> CliResult<String> { |
| 180 | if let Some(s) = org_override { |
| 181 | if s.is_empty() { |
| 182 | return Err(CliError::InvalidArgument { |
| 183 | message: "Organization slug cannot be empty.".to_string(), |
| 184 | }); |
| 185 | } |
| 186 | return Ok(s.to_string()); |
| 187 | } |
| 188 | |
| 189 | let config = GlobalConfig::load() |
| 190 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to load global config: {}", e)))?; |
| 191 | |
| 192 | config |
| 193 | .server |
| 194 | .default_org |
| 195 | .ok_or_else(|| CliError::InvalidArgument { |
| 196 | message: "No organization specified.\n \ |
| 197 | Use --org or set a default with: atomic org set <slug>" |
| 198 | .to_string(), |
| 199 | }) |
| 200 | } |
| 201 | |
| 202 | /// Resolve the workspace slug for a command, with fallback to the |
| 203 | /// org-scoped default workspace from a server config. |