mod builtins;
#[cfg(feature = "cel")]
mod cel;
mod config;
mod detect;
mod discovery;
mod error;
mod find;
mod indicator;
mod project_type;
mod registry;
mod resolver;
use std::path::{Path, PathBuf};
pub use config::{Config, ConfigEntry, ConfigIndicator};
pub use discovery::{
discovery_entries, discovery_paths, DiscoveryEntry, CONFIG_DIR_NAME, CONFIG_FILE_NAME,
PER_PROJECT_DIR_NAME,
};
pub use error::{Error, Result};
pub use find::{FindOptions, FindResult, FoundProject};
pub use indicator::{Indicator, Match};
pub use project_type::ProjectType;
pub use registry::Registry;
pub use resolver::Resolver;
use registry::DEFAULT;
pub fn detect(dir: impl AsRef<Path>) -> Vec<Match> {
DEFAULT.read().unwrap().detect(dir)
}
pub fn find(root: impl AsRef<Path>, opts: &FindOptions) -> Result<FindResult> {
DEFAULT.read().unwrap().find(root, opts)
}
pub fn resolve_for_path(file_path: impl AsRef<Path>) -> Option<(PathBuf, Vec<Match>)> {
DEFAULT.read().unwrap().resolve_for_path(file_path)
}
pub fn collect_build_excludes(root: impl AsRef<Path>) -> Result<Vec<String>> {
DEFAULT.read().unwrap().collect_build_excludes(root)
}
pub fn register(t: ProjectType) -> Result<()> {
DEFAULT.write().unwrap().register(t)
}
pub fn load_from_file(path: impl AsRef<Path>) -> Result<usize> {
DEFAULT.write().unwrap().load_from_file(path)
}
pub fn load_discovered() -> Result<usize> {
DEFAULT.write().unwrap().load_discovered()
}
pub fn type_names() -> Vec<String> {
DEFAULT
.read()
.unwrap()
.types()
.into_iter()
.map(|t| t.name.clone())
.collect()
}