Skip to content

Commit b61029b

Browse files
committed
fix: smart cask fallback for tap packages
1 parent 11ed4e6 commit b61029b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

internal/brew/brew.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,16 @@ func installFormulaWithError(pkg string) string {
302302
cmd := exec.Command("brew", "install", pkg)
303303
output, err := cmd.CombinedOutput()
304304
if err != nil {
305-
return parseBrewError(string(output))
305+
outputStr := string(output)
306+
if strings.Contains(strings.ToLower(outputStr), "try again using") && strings.Contains(strings.ToLower(outputStr), "--cask") {
307+
cmd2 := exec.Command("brew", "install", "--cask", pkg)
308+
output2, err2 := cmd2.CombinedOutput()
309+
if err2 != nil {
310+
return parseBrewError(string(output2))
311+
}
312+
return ""
313+
}
314+
return parseBrewError(outputStr)
306315
}
307316
return ""
308317
}

0 commit comments

Comments
 (0)