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

Function parse_input_arg

resources/windows_service/src/main.rs:135–148  ·  view source on GitHub ↗

Parse the `--input ` argument from the command-line args.

(args: &[String])

Source from the content-addressed store, hash-verified

133
134/// Parse the `--input <json>` argument from the command-line args.
135fn parse_input_arg(args: &[String]) -> Option<String> {
136 let mut i = 2; // skip binary name and operation
137 while i < args.len() {
138 if args[i] == "--input" || args[i] == "-i" {
139 if i + 1 < args.len() {
140 return Some(args[i + 1].clone());
141 }
142 write_error(&t!("main.missingInputValue"));
143 exit(EXIT_INVALID_ARGS);
144 }
145 i += 1;
146 }
147 None
148}

Callers 1

mainFunction · 0.70

Calls 1

write_errorFunction · 0.70

Tested by

no test coverage detected