ast-bro 2.4.3

Fast, AST-based code-navigation: shape, public API, deps & call graphs, hybrid semantic search, structural rewrite, and log squeezing. MCP server included.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use glob::glob;
use std::path::{Path, PathBuf};

pub fn expand_existing(path: &Path) -> Vec<PathBuf> {
    if path.exists() {
        return vec![path.to_path_buf()];
    }
    expand_pattern(path)
}

pub fn expand_pattern(pattern: &Path) -> Vec<PathBuf> {
    glob(&pattern.to_string_lossy().replace('\\', "/"))
        .map(|paths| paths.filter_map(Result::ok).collect())
        .unwrap_or_default()
}