MCPcopy Index your code
hub / github.com/PowerShell/DSC / config_get

Function config_get

dsc/src/subcommand.rs:47–80  ·  view source on GitHub ↗
(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool)

Source from the content-addressed store, hash-verified

45use tracing::{debug, error, trace};
46
47pub 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
82pub fn config_set(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool)
83{

Callers 1

configFunction · 0.70

Calls 3

write_objectFunction · 0.85
invoke_getMethod · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected