Skip to main content

detect_languages

Function detect_languages 

Source
pub fn detect_languages(dir: &Path) -> Vec<Language>
Expand description

独立检测目录下的所有编程语言,不依赖优先级(每个标志文件独立检查)。

monorepo 根目录可能同时存在多种语言的配置文件(如 Cargo.toml + pyproject.toml), 此函数返回所有匹配的语言,适合需要检查所有工具链的场景(如 CLI doctor status)。

use std::path::Path;
use quanttide_devops::source::config_file::detect_languages;

let langs = detect_languages(Path::new("/tmp/nonexistent"));
assert!(langs.is_empty());