(configurator: &mut Configurator, format: Option<&OutputFormat>)
| 216 | } |
| 217 | |
| 218 | pub fn config_export(configurator: &mut Configurator, format: Option<&OutputFormat>) |
| 219 | { |
| 220 | match configurator.invoke_export() { |
| 221 | Ok(result) => { |
| 222 | let json = match serde_json::to_string(&result.result) { |
| 223 | Ok(json) => json, |
| 224 | Err(err) => { |
| 225 | error!("JSON: {err}"); |
| 226 | exit(EXIT_JSON_ERROR); |
| 227 | } |
| 228 | }; |
| 229 | write_object(&json, format, false); |
| 230 | if result.had_errors { |
| 231 | |
| 232 | for msg in result.messages |
| 233 | { |
| 234 | error!("{:?} {} {}", msg.level, t!("subcommand.message"), msg.message); |
| 235 | }; |
| 236 | |
| 237 | exit(EXIT_DSC_ERROR); |
| 238 | } |
| 239 | }, |
| 240 | Err(err) => { |
| 241 | error!("{err}"); |
| 242 | exit(EXIT_DSC_ERROR); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | fn initialize_config_root(path: Option<&String>) -> Option<String> { |
| 248 | // code that calls this pass in either None, Some("-"), or Some(path) |
no test coverage detected