summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-28 14:49:00 +0800
committerEltrac <hi@guhub.cn>2025-11-28 14:49:00 +0800
commit34c7edaaec449e287530537302d3c7459d93fdec (patch)
tree5b1697d21501c6d3ba3f90997aebcf485a3aa67b /main.go
parent8284b647b787e63883257b5bf046fe0b27aaa266 (diff)
feat(cli): new command `wthis list`
Diffstat (limited to 'main.go')
-rw-r--r--main.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/main.go b/main.go
index 8ec0015..a2af868 100644
--- a/main.go
+++ b/main.go
@@ -3,10 +3,11 @@ package main
import (
"context"
"fmt"
- "github.com/fatih/color"
- "github.com/urfave/cli/v3"
"log"
"os"
+
+ "github.com/fatih/color"
+ "github.com/urfave/cli/v3"
)
var NoCache, DoClearCache bool
@@ -51,7 +52,24 @@ func main() {
Aliases: []string{"l", "ls"},
Usage: "Better brew list.",
Action: func(ctx context.Context, cmd *cli.Command) error {
- // TODO
+ depmap := GetBrewDeps()
+ list := GetBrewList()
+
+ for _, pkg := range list {
+ deps := depmap[pkg]
+ count := len(deps)
+
+ color.New(color.FgBlue).Printf("%s", pkg)
+ if count > 1 {
+ fmt.Printf(" (%d dependencies): \n", count)
+ } else {
+ fmt.Printf(" (%d dependency): \n", count)
+ }
+
+ for _, dep := range deps {
+ fmt.Printf(" ► %s\n", dep)
+ }
+ }
return nil
},
},