summaryrefslogtreecommitdiff
path: root/brewget.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-11 19:32:34 +0800
committerEltrac <hi@guhub.cn>2025-11-11 19:32:34 +0800
commiteb5d4249c6db97bbbb52fd86c1451be50bb33398 (patch)
treee783bec52b0cea2a216671b211d432f34e3764f5 /brewget.go
parent085a48a39702e2fed1f771c3fb23c062704957e4 (diff)
fix: make sure to exit when certain error occurs
Diffstat (limited to 'brewget.go')
-rw-r--r--brewget.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/brewget.go b/brewget.go
index 202e985..4edcfc0 100644
--- a/brewget.go
+++ b/brewget.go
@@ -40,8 +40,7 @@ type CaskInfo struct {
func GetBrewInfo(pkg string) (*FormulaInfo, *CaskInfo) {
out, err := exec.Command("brew", "info", "--json=v2", pkg).Output()
if err != nil {
- color.Red("❌ Error fetching info. Please check for typo.")
- return nil, nil
+ printErrorAndExit("Error fetching info. Please check for typo.")
}
var data struct {
@@ -50,8 +49,7 @@ func GetBrewInfo(pkg string) (*FormulaInfo, *CaskInfo) {
}
if err := json.Unmarshal(out, &data); err != nil {
- color.Red("❌ Error parsing data.")
- return nil, nil
+ printErrorAndExit("Error parsing data.")
}
if len(data.Formulae) > 0 {