Skip to main content

command_line_contains_path

Function command_line_contains_path 

Source
pub fn command_line_contains_path(
    command_line: &str,
    path: impl AsRef<Path>,
    options: CommandLinePathMatchOptions,
) -> Result<bool, PathError>
Expand description

Returns true if command_line appears to reference path.

This is a heuristic matcher for tooling, not a full shell parser. It does not invoke a shell or execute command-line content.

§Filesystem access

No (identity-key path uses lexical options only).

§Behavior

  1. Rejects empty target paths.
  2. Tokenizes the command line (optional quotes).
  3. Matches full path, separator-normalized form, and optional identity key.
  4. Optionally matches basename (document as fuzzy when enabled).
  5. Avoids pure substring matches when require_component_boundary is true.