Skip to content

Commit

Permalink
feat: print tags in nodes list
Browse files Browse the repository at this point in the history
  • Loading branch information
restanrm committed Apr 16, 2022
1 parent 4fcc5e2 commit 4651c44
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/headscale/cli/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ func nodesToPtables(
"Last seen",
"Online",
"Expired",
"Tags",
},
}

Expand Down Expand Up @@ -356,6 +357,22 @@ func nodesToPtables(
expired = pterm.LightRed("yes")
}

var tags string
for _, tag := range machine.ForcedTags {
tags += "," + tag
}
for _, tag := range machine.InvalidTags {
if !containsString(machine.ForcedTags, tag) {
tags += "," + pterm.LightRed(tag)
}
}
for _, tag := range machine.ValidTags {
if !containsString(machine.ForcedTags, tag) {
tags += "," + pterm.LightGreen(tag)
}
}
tags = strings.TrimLeft(tags, ",")

var namespace string
if currentNamespace == "" || (currentNamespace == machine.Namespace.Name) {
namespace = pterm.LightMagenta(machine.Namespace.Name)
Expand All @@ -375,6 +392,7 @@ func nodesToPtables(
lastSeenTime,
online,
expired,
tags,
},
)
}
Expand Down

0 comments on commit 4651c44

Please sign in to comment.