(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool)
| 45 | use tracing::{debug, error, trace}; |
| 46 | |
| 47 | pub fn config_get(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool) |
| 48 | { |
| 49 | match configurator.invoke_get() { |
| 50 | Ok(result) => { |
| 51 | if *as_group { |
| 52 | let json = match serde_json::to_string(&(result.results)) { |
| 53 | Ok(json) => json, |
| 54 | Err(err) => { |
| 55 | error!("JSON Error: {err}"); |
| 56 | exit(EXIT_JSON_ERROR); |
| 57 | } |
| 58 | }; |
| 59 | write_object(&json, format, false); |
| 60 | } |
| 61 | else { |
| 62 | let json = match serde_json::to_string(&result) { |
| 63 | Ok(json) => json, |
| 64 | Err(err) => { |
| 65 | error!("JSON Error: {err}"); |
| 66 | exit(EXIT_JSON_ERROR); |
| 67 | } |
| 68 | }; |
| 69 | write_object(&json, format, false); |
| 70 | if result.had_errors { |
| 71 | exit(EXIT_DSC_ERROR); |
| 72 | } |
| 73 | } |
| 74 | }, |
| 75 | Err(err) => { |
| 76 | error!("{err}"); |
| 77 | exit(EXIT_DSC_ERROR); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | pub fn config_set(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool) |
| 83 | { |
no test coverage detected