proc_cmd

Function proc_cmd 

Source
pub(crate) fn proc_cmd(
    cmd: &str,
    text: &[String],
    file_string: Option<&str>,
    opts: &Options,
    stats: &mut Stats,
) -> bool
Expand description

Substitute placeholders in a command template and execute the result.

§Modes

  • Default mode (one invocation per match): %0 = basename, %1 = full path, %2+ = extra args, %b = stem, %e = extension.
  • --list-all mode (-l): all matching file paths are collected first by fill_list(), joined into a single space-delimited string, and passed as file_string. In this mode %0 is replaced with the entire list of matched paths rather than an individual filename.

Supports confirm mode, dry-run, parallel forking, and stop-on-error.

§Arguments

  • cmd — the command template string containing % placeholders
  • text — slice of strings: text[0] is the matched file path (unused in list-all mode), text[1+] are extra CLI arguments
  • file_string — when --list-all is active, the space-joined list of all matched paths; None in default per-file mode
  • opts — runtime options
  • stats — mutable execution statistics

§Returns

true to continue processing, false to stop (stop-on-error triggered).