MCPcopy Create free account
hub / github.com/PowerShell/DSC / config_export

Function config_export

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

Source from the content-addressed store, hash-verified

216}
217
218pub 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
247fn initialize_config_root(path: Option<&String>) -> Option<String> {
248 // code that calls this pass in either None, Some("-"), or Some(path)

Callers 1

configFunction · 0.85

Calls 3

write_objectFunction · 0.85
invoke_exportMethod · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected