Skip to main content

scan_environment

Function scan_environment 

Source
pub fn scan_environment(root: &Path) -> (EnvironmentConfig, Option<String>)
Expand description

Scans repository root for runtime environments (pyenv, uv, venv), version files, and cache directories to share.

Returns detected EnvironmentConfig and an optional cache directory name to share (e.g. ".venv").

ยงExamples

use git_claw::workflow::init::scan_environment;
use tempfile::tempdir;
use std::fs;

let dir = tempdir().unwrap();
fs::write(dir.path().join(".python-version"), "3.12.0\n").unwrap();
let (env, cache_dir) = scan_environment(dir.path());
assert_eq!(env.r#type.as_deref(), Some("pyenv"));
assert_eq!(env.name.as_deref(), Some("3.12.0"));
assert!(env.copy_files.contains(&".python-version".to_string()));
assert_eq!(cache_dir, None);