Parse the `--input ` argument from the command-line args.
(args: &[String])
| 133 | |
| 134 | /// Parse the `--input <json>` argument from the command-line args. |
| 135 | fn 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 | } |