Skip to content

Commit

Permalink
add new tag unprintable to prevent printing specific field
Browse files Browse the repository at this point in the history
  • Loading branch information
lanphan committed Sep 14, 2024
1 parent 25a2203 commit 0a0620b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/dynamic/print_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool,
continue
}
if jtag := tt.Tag.Get("json"); jtag != "" && jtag != "-" {
unprintable := tt.Tag.Get("unprintable")
if unprintable == "true" {
continue
}
name := strings.Split(jtag, ",")[0]
if _, ok := redundantSet[name]; ok {
continue
Expand All @@ -106,6 +110,10 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool,
}
default:
name := strings.Split(jsonTag, ",")[0]
unprintable := t.Tag.Get("unprintable")
if unprintable == "true" {
continue
}
if _, ok := redundantSet[name]; ok {
continue
}
Expand Down

0 comments on commit 0a0620b

Please sign in to comment.