Skip to content

Commit 264217f

Browse files
committed
Colorizing lscmd Outputs
1 parent 683eb7b commit 264217f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gincmd/lscmd.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,17 @@ func lsRepo(cmd *cobra.Command, args []string) {
6868
// print each category with len(items) > 0 with appropriate header
6969
for _, status := range statuses {
7070
fmt.Printf("%s:\n", status.Description())
71-
fmt.Printf("\n\t%s\n\n", strings.Join(statFiles[status], "\n\t"))
71+
switch d := status.Description(); {
72+
case strings.Contains(d, "modified"):
73+
fmt.Printf(green("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t"))
74+
case d == "Untracked":
75+
fmt.Printf(red("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t"))
76+
case d == "Removed":
77+
fmt.Printf(yellow("\n\t%s\n\n"), strings.Join(statFiles[status], "\n\t"))
78+
default:
79+
fmt.Printf("\n\t%s\n\n", strings.Join(statFiles[status], "\n\t"))
80+
}
81+
7282
}
7383
}
7484
}

0 commit comments

Comments
 (0)