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

Function config_set

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

Source from the content-addressed store, hash-verified

80}
81
82pub fn config_set(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool)
83{
84 match configurator.invoke_set(false) {
85 Ok(result) => {
86 if *as_group {
87 let json = match serde_json::to_string(&(result.results)) {
88 Ok(json) => json,
89 Err(err) => {
90 error!("JSON Error: {err}");
91 exit(EXIT_JSON_ERROR);
92 }
93 };
94 write_object(&json, format, false);
95 }
96 else {
97 let json = match serde_json::to_string(&result) {
98 Ok(json) => json,
99 Err(err) => {
100 error!("JSON Error: {err}");
101 exit(EXIT_JSON_ERROR);
102 }
103 };
104 write_object(&json, format, false);
105 if result.had_errors {
106 exit(EXIT_DSC_ERROR);
107 }
108 }
109 },
110 Err(err) => {
111 error!("Error: {err}");
112 exit(EXIT_DSC_ERROR);
113 }
114 }
115}
116
117pub fn config_test(configurator: &mut Configurator, format: Option<&OutputFormat>, as_group: &bool, as_get: &bool, as_config: &bool, as_assert: &bool)
118{

Callers 1

configFunction · 0.70

Calls 3

write_objectFunction · 0.85
invoke_setMethod · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected