Split a command string into tokens on whitespace and shell operators, extracting the file name from each token (stripping directory paths).
(command: &str)
| 6 | /// Split a command string into tokens on whitespace and shell operators, |
| 7 | /// extracting the file name from each token (stripping directory paths). |
| 8 | fn tokenize(command: &str) -> impl Iterator<Item = &str> + '_ { |
| 9 | command |
| 10 | .split(|c: char| c.is_whitespace() || SHELL_SEPARATORS.contains(&c)) |
| 11 | .filter(|t| !t.is_empty()) |
| 12 | .filter_map(|token| Path::new(token).file_name()?.to_str()) |
| 13 | } |
| 14 | |
| 15 | /// Check if a command string contains any of the given executable names. |
| 16 | /// |
no test coverage detected