Skip to content

Commit fed55b4

Browse files
committed
fix specifying a version with use or install in a folder with a version file
1 parent 840000f commit fed55b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/subcommand/install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Action<InstallCommand> for InstallCommand {
3232
let version_filter = options
3333
.version
3434
.clone()
35-
.xor(files::get_version_file().map(|version_file| version_file.range()));
35+
.or_else(|| files::get_version_file().map(|version_file| version_file.range()));
3636

3737
if version_filter.is_none() {
3838
anyhow::bail!("You did not pass a version and we did not find any version files (package.json#engines, .nvmrc) in the current directory.");

src/subcommand/switch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Action<SwitchCommand> for SwitchCommand {
3737
let version_filter = options
3838
.clone()
3939
.version
40-
.xor(files::get_version_file().map(|version_file| version_file.range()));
40+
.or_else(|| files::get_version_file().map(|version_file| version_file.range()));
4141

4242
if version_filter.is_none() {
4343
anyhow::bail!("You did not pass a version and we did not find any version files (package.json#engines, .nvmrc) in the current directory.");

0 commit comments

Comments
 (0)