diff --git a/CHANGELOG.md b/CHANGELOG.md index ad704ec2f..26b2ec9c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ #### Updates +- Added a `detect-strategy` setting to `~/.proto/config.toml` to configure which strategy to use when detecting a version. Accepts: + - `first-available` (default) - Will use the first available version that is found. Either from `.prototools` or a tool specific file (`.nvmrc`, etc). + - `prefer-prototools` - Prefer a `.prototools` version, even if found in a parent directory. If none found, falls back to tool specific file. - Added support to plugins to ignore certain paths when detecting a version. - WASM API - Added `DetectVersionOutput.ignore` field. diff --git a/crates/core/src/version_detector.rs b/crates/core/src/version_detector.rs index 0e6dbe8c6..97d41959e 100644 --- a/crates/core/src/version_detector.rs +++ b/crates/core/src/version_detector.rs @@ -11,7 +11,7 @@ pub async fn detect_version_first_available( start_dir: &Path, end_dir: &Path, ) -> miette::Result> { - let mut current_dir: Option<&Path> = Some(&start_dir); + let mut current_dir: Option<&Path> = Some(start_dir); while let Some(dir) = current_dir { trace!( @@ -61,7 +61,7 @@ pub async fn detect_version_prefer_prototools( let mut config_version = None; let mut config_path = None; let mut ecosystem_version = None; - let mut current_dir: Option<&Path> = Some(&start_dir); + let mut current_dir: Option<&Path> = Some(start_dir); while let Some(dir) = current_dir { trace!(