Resolve the org slug for a command, with fallback to the configured default. This variant uses the *active* server's `default_org` so that per-server org defaults are respected. Resolution order: 1. `--org` override (if `Some(non-empty)`) 2. `server.default_org` from the resolved server profile 3. Error with a hint to run `atomic org set` An explicit empty string (`--org ""`) is an error: the u
(
org_override: Option<&str>,
server: &atomic_config::ServerConfig,
)
| 224 | /// An explicit empty string (`--org ""`) is an error: the user asked for "no |
| 225 | /// org" which never makes sense. |
| 226 | pub fn resolve_org_with_server( |
| 227 | org_override: Option<&str>, |
| 228 | server: &atomic_config::ServerConfig, |
| 229 | ) -> CliResult<String> { |
| 230 | if let Some(s) = org_override { |
| 231 | if s.is_empty() { |
| 232 | return Err(CliError::InvalidArgument { |
| 233 | message: "Organization slug cannot be empty.".to_string(), |
| 234 | }); |
| 235 | } |
| 236 | return Ok(s.to_string()); |
| 237 | } |
| 238 | |
| 239 | server |
| 240 | .default_org |
| 241 | .clone() |
| 242 | .ok_or_else(|| CliError::InvalidArgument { |
| 243 | message: "No organization specified.\n \ |
| 244 | Use --org or set a default with: atomic org set <slug>" |
| 245 | .to_string(), |
| 246 | }) |
| 247 | } |
| 248 | |
| 249 | /// Resolve the org slug using the legacy (single-server) config path. |
| 250 | /// |
no test coverage detected