Skip to content

Commit 0c56957

Browse files
committed
fix(stubs): lookup for aqua tools stubs fails because of tool options
- tool options introduced with PR #6807 lead to lookup failures in context of aqua and tool stubs
1 parent 8eef7a4 commit 0c56957

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

e2e/cli/test_tool_stub_basic

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,17 @@ assert_contains "bin/gh --version" "gh version"
8484
assert_contains "bin/gh --version" "gh version" # short-circuit works
8585
mise uninstall --all
8686
assert_contains "bin/gh --version" "gh version" # refetches even if it's cached
87+
88+
# Test 12: Aqua backend
89+
cat >bin/flyctl <<'EOF'
90+
#!/usr/bin/env -S mise tool-stub
91+
tool = "flyctl"
92+
version = "0.3.206"
93+
bin = "flyctl"
94+
EOF
95+
96+
chmod +x bin/flyctl
97+
98+
assert_contains "bin/flyctl version" "flyctl v0.3.206"
99+
mise uninstall --all
100+
assert_contains "bin/flyctl version" "flyctl v0.3.206"

src/backend/aqua.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl Backend for AquaBackend {
247247

248248
impl AquaBackend {
249249
pub fn from_arg(ba: BackendArg) -> Self {
250-
let full = ba.full();
250+
let full = ba.full_without_opts();
251251
let mut id = full.split_once(":").unwrap_or(("", &full)).1;
252252
if !id.contains("/") {
253253
id = REGISTRY

src/cli/args/backend_arg.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ impl BackendArg {
273273
full
274274
}
275275

276+
pub fn full_without_opts(&self) -> String {
277+
let full = self.full();
278+
if let Some(c) = regex!(r"^(.+)\[(.+)\]$").captures(&full) {
279+
return c.get(1).unwrap().as_str().to_string();
280+
}
281+
full
282+
}
283+
276284
pub fn opts(&self) -> ToolVersionOptions {
277285
self.opts.clone().unwrap_or_else(|| {
278286
if let Some(c) = regex!(r"^(.+)\[(.+)\]$").captures(&self.full()) {

0 commit comments

Comments
 (0)