MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / tokenize

Function tokenize

src/executor/helpers/detect_executable.rs:8–13  ·  view source on GitHub ↗

Split a command string into tokens on whitespace and shell operators, extracting the file name from each token (stripping directory paths).

(command: &str)

Source from the content-addressed store, hash-verified

6/// Split a command string into tokens on whitespace and shell operators,
7/// extracting the file name from each token (stripping directory paths).
8fn 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///

Callers 1

command_has_executableFunction · 0.85

Calls 2

file_nameMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected