extract_pattern_filename

Function extract_pattern_filename 

Source
pub fn extract_pattern_filename(base_path: &Path, matched_path: &Path) -> String
Expand description

Extracts the meaningful path for pattern matching.

Constructs the full path from base path and matched path, then extracts the meaningful structure by removing redundant directory prefixes.

§Arguments

  • base_path - The base directory the pattern was resolved in
  • matched_path - The path to the matched file (relative to base_path)

§Returns

The meaningful path structure string.

§Examples

use std::path::{Path, PathBuf};
use agpm_cli::resolver::path_resolver::extract_pattern_filename;

let base = PathBuf::from(".");
let matched = Path::new("agents/helper.md");
let filename = extract_pattern_filename(&base, matched);
assert_eq!(filename, "agents/helper.md");