Skip to main content

predict_paths

Function predict_paths 

Source
pub fn predict_paths(cmd: &ProposedCommand) -> Vec<PathBuf>
Expand description

Predict the filesystem paths a command is likely to touch.

Conservative and dependency-free, but shell-segment aware: the raw line is split on ;, &&, ||, | and newlines (outside quotes), each segment is tokenised, and a leading cd <dir> updates the effective cwd for the rest of the line — so cd build; rm -rf ../dist resolves ../dist against build, not the original cwd. Non-flag arguments and redirect targets become candidates; bogus ones are harmless (only paths that exist are captured).