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,
)
| 151 | /// An explicit empty string (`--org ""`) is an error: the user asked for "no |
| 152 | /// org" which never makes sense. |
| 153 | pub fn resolve_org_with_server( |
| 154 | org_override: Option<&str>, |
| 155 | server: &atomic_config::ServerConfig, |
| 156 | ) -> CliResult<String> { |
| 157 | if let Some(s) = org_override { |
| 158 | if s.is_empty() { |
| 159 | return Err(CliError::InvalidArgument { |
| 160 | message: "Organization slug cannot be empty.".to_string(), |
| 161 | }); |
| 162 | } |
| 163 | return Ok(s.to_string()); |
| 164 | } |
| 165 | |
| 166 | server |
| 167 | .default_org |
| 168 | .clone() |
| 169 | .ok_or_else(|| CliError::InvalidArgument { |
| 170 | message: "No organization specified.\n \ |
| 171 | Use --org or set a default with: atomic org set <slug>" |
| 172 | .to_string(), |
| 173 | }) |
| 174 | } |
| 175 | |
| 176 | /// Resolve the org slug using the legacy (single-server) config path. |
| 177 | /// |
no test coverage detected