Skip to content

Commit

Permalink
fix specifying a version with use or install in a folder with a v…
Browse files Browse the repository at this point in the history
…ersion file
  • Loading branch information
beeequeue committed Jul 6, 2022
1 parent 840000f commit fed55b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/subcommand/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Action<InstallCommand> for InstallCommand {
let version_filter = options
.version
.clone()
.xor(files::get_version_file().map(|version_file| version_file.range()));
.or_else(|| files::get_version_file().map(|version_file| version_file.range()));

if version_filter.is_none() {
anyhow::bail!("You did not pass a version and we did not find any version files (package.json#engines, .nvmrc) in the current directory.");
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Action<SwitchCommand> for SwitchCommand {
let version_filter = options
.clone()
.version
.xor(files::get_version_file().map(|version_file| version_file.range()));
.or_else(|| files::get_version_file().map(|version_file| version_file.range()));

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

0 comments on commit fed55b4

Please sign in to comment.