Skip to content

Commit

Permalink
fix: ls-remote doesn't support @sub-x style versions (jdx#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
roele authored and triarius committed Sep 18, 2024
1 parent 3a9e923 commit 4be14b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cli/ls_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rayon::prelude::*;
use crate::backend;
use crate::backend::Backend;
use crate::cli::args::ToolArg;
use crate::toolset::ToolRequest;
use crate::toolset::{ToolRequest, ToolVersion};
use crate::ui::multi_progress_report::MultiProgressReport;

/// List runtime versions available for install
Expand Down Expand Up @@ -45,6 +45,10 @@ impl LsRemote {
let prefix = match &self.plugin {
Some(tool_arg) => match &tool_arg.tvr {
Some(ToolRequest::Version { version: v, .. }) => Some(v.clone()),
Some(ToolRequest::Sub { .. }) => match tool_arg.clone().tvr {
Some(tvr) => Some(ToolVersion::resolve(plugin.as_ref(), tvr, false)?.version),
None => None,
},
_ => self.prefix.clone(),
},
_ => self.prefix.clone(),
Expand Down Expand Up @@ -128,5 +132,6 @@ mod tests {
fn test_ls_remote_prefix() {
assert_cli_snapshot!("list-remote", "dummy", "1");
assert_cli_snapshot!("list-remote", "dummy@2");
assert_cli_snapshot!("list-remote", "dummy@sub-1:2");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: src/cli/ls_remote.rs
expression: output
---
1.1.0

0 comments on commit 4be14b3

Please sign in to comment.