Skip to content

Commit

Permalink
update color
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolethanh committed Nov 15, 2022
1 parent 907eaad commit 80fcf3c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ func printByPathStacks(stacks []*fiber.Route) {
paths := sortedKeys(byPathStacks)

for _, path := range paths {
color.HiYellow(path)
routes := byPathStacks[path]
color.HiMagenta(path)
routes := lo.UniqBy(byPathStacks[path], func(route *fiber.Route) string {
return route.Method
})
fmt.Print(" ➜")

for _, route := range routes {
params := getRouteParams(route)
method := route.Method
Expand All @@ -69,7 +72,9 @@ func printByPathStacks(stacks []*fiber.Route) {
switch method {
case "OPTIONS":
c = color.HiCyanString
case "GET", "POST", "PUT", "PATCH":
case "GET":
c = color.HiYellowString
case "POST", "PUT", "PATCH":
c = color.HiGreenString
case "DELETE":
c = color.HiRedString
Expand Down

0 comments on commit 80fcf3c

Please sign in to comment.