44 "fmt"
55 "strings"
66
7+ "github.com/fatih/color"
78 "github.com/spf13/cobra"
89 "github.com/itzcodex24/git-guardian/internal/supervisor"
910)
@@ -13,20 +14,36 @@ var listenersCmd = &cobra.Command{
1314 Short : "List all configured watchers" ,
1415 RunE : func (cmd * cobra.Command , args []string ) error {
1516 list := supervisor .List ()
16- fmt .Printf ("\n %-8s %-15s %-38s %-10s %-25s\n " , "ID" , "Mode" , "Folder" , "Status" , "LastRun" )
17- fmt .Println (strings .Repeat ("-" , 110 ))
17+
18+ cyan := color .New (color .FgCyan , color .Bold )
19+ fmt .Println ()
20+ cyan .Printf ("%-8s %-15s %-38s %-10s %-25s\n " , "ID" , "Mode" , "Folder" , "Status" , "LastRun" )
21+ color .Cyan (strings .Repeat ("─" , 110 ))
22+
1823 for _ , w := range list {
19- status := "paused"
24+ statusColor := color .New (color .FgYellow )
25+ statusText := "paused"
2026 if ! w .Paused {
21- status = "running"
27+ statusColor = color .New (color .FgGreen )
28+ statusText = "running"
2229 }
30+
2331 mode := w .Mode
32+ modeColor := color .New (color .FgWhite )
2433 if w .Mode == "interval" && w .Interval != "" {
2534 mode = fmt .Sprintf ("interval (%s)" , w .Interval )
35+ modeColor = color .New (color .FgMagenta )
2636 } else if w .Mode == "watch" && w .Debounce != "" {
2737 mode = fmt .Sprintf ("watch (%s)" , w .Debounce )
38+ modeColor = color .New (color .FgBlue )
2839 }
29- fmt .Printf ("%-8s %-15s %-38s %-10s %-25s\n " , w .ID , mode , w .Folder , status , w .LastRun )
40+
41+ idColor := color .New (color .FgHiWhite , color .Bold )
42+ idColor .Printf ("%-8s " , w .ID )
43+ modeColor .Printf ("%-15s " , mode )
44+ fmt .Printf ("%-38s " , w .Folder )
45+ statusColor .Printf ("%-10s " , statusText )
46+ color .New (color .FgHiBlack ).Printf ("%-25s\n " , w .LastRun )
3047 }
3148 return nil
3249 },
0 commit comments