DO NOT REVIEW THIS CODE BY HAND This parsing code is quite complex and not easy to hand-modify. The easiest way to iterate is to add unit tests and have Codex fix the implementation. To encourage this, the tests have been put directly below this function rather than at the bottom of the Parses metadata out of an arbitrary command. These commands are model driven and could include just about anyth
(command: &[String])
| 75 | /// The goal of the parsed metadata is to be able to provide the user with a human readable gis |
| 76 | /// of what it is doing. |
| 77 | pub fn parse_command(command: &[String]) -> Vec<ParsedCommand> { |
| 78 | // Parse and then collapse consecutive duplicate commands to avoid redundant summaries. |
| 79 | let parsed = parse_command_impl(command); |
| 80 | let mut deduped: Vec<ParsedCommand> = Vec::with_capacity(parsed.len()); |
| 81 | for cmd in parsed.into_iter() { |
| 82 | if deduped.last().is_some_and(|prev| prev == &cmd) { |
| 83 | continue; |
| 84 | } |
| 85 | deduped.push(cmd); |
| 86 | } |
| 87 | deduped |
| 88 | } |
| 89 | |
| 90 | #[cfg(test)] |
| 91 | #[allow(clippy::items_after_test_module)] |