Skip to content

Commit

Permalink
Merge pull request #1743 from lanphan/printconfig
Browse files Browse the repository at this point in the history
add new tag ignore to prevent printing specific field
  • Loading branch information
c9s authored Oct 28, 2024
2 parents 39d3dc0 + dad7b53 commit 58133d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/dynamic/print_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool,
continue
}
if jtag := tt.Tag.Get("json"); jtag != "" && jtag != "-" {
if ig := tt.Tag.Get("ignore"); ig == "true" {
continue
}
name := strings.Split(jtag, ",")[0]
if _, ok := redundantSet[name]; ok {
continue
Expand All @@ -106,6 +109,9 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool,
}
default:
name := strings.Split(jsonTag, ",")[0]
if ig := t.Tag.Get("ignore"); ig == "true" {
continue
}
if _, ok := redundantSet[name]; ok {
continue
}
Expand Down

0 comments on commit 58133d9

Please sign in to comment.