parse_rule_string

Function parse_rule_string 

Source
pub fn parse_rule_string(
    rule_string: &str,
    separator: &str,
) -> Result<(Vec<String>, Vec<String>)>
Expand description

Parse a rule string into extra_files and ignore_patterns

§Arguments

  • rule_string - The rule string to parse (e.g., “Cargo.toml + src + !target”)
  • separator - The separator used in the rule string (e.g., “ + “)

§Returns

A tuple of (extra_files, ignore_patterns)

§Rules

  • Items without “!” prefix are added to extra_files
  • Items with “!” prefix are added to ignore_patterns (without the “!” prefix)
  • Empty items are ignored
  • Leading and trailing whitespace is trimmed

§Examples

use code_packager::parse_rule_string;

let (extra, ignore) = parse_rule_string("file.txt + src + !target", " + ").unwrap();
assert_eq!(extra, vec!["file.txt", "src"]);
assert_eq!(ignore, vec!["target"]);