Skip to content

Commit 79aa731

Browse files
committed
Bumping tablewriter to v1.0.9 - latest
1 parent 0db4bf4 commit 79aa731

File tree

7 files changed

+108
-74
lines changed

7 files changed

+108
-74
lines changed

go.mod

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/google/cel-go v0.26.0
2222
github.com/google/go-cmp v0.7.0
2323
github.com/google/go-github/v53 v53.2.0
24-
github.com/olekukonko/tablewriter v0.0.5
24+
github.com/olekukonko/tablewriter v1.0.9
2525
github.com/onsi/ginkgo/v2 v2.25.3
2626
github.com/onsi/gomega v1.38.2
2727
github.com/pkg/errors v0.9.1
@@ -99,23 +99,26 @@ require (
9999
github.com/json-iterator/go v1.1.12 // indirect
100100
github.com/kylelemons/godebug v1.1.0 // indirect
101101
github.com/mailru/easyjson v0.7.7 // indirect
102-
github.com/mattn/go-colorable v0.1.13 // indirect
102+
github.com/mattn/go-colorable v0.1.14 // indirect
103103
github.com/mattn/go-isatty v0.0.20 // indirect
104-
github.com/mattn/go-runewidth v0.0.14 // indirect
104+
github.com/mattn/go-runewidth v0.0.16 // indirect
105105
github.com/mitchellh/copystructure v1.2.0 // indirect
106106
github.com/mitchellh/reflectwalk v1.0.2 // indirect
107107
github.com/moby/spdystream v0.5.0 // indirect
108108
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
109109
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
110110
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
111111
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
112+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
113+
github.com/olekukonko/errors v1.1.0 // indirect
114+
github.com/olekukonko/ll v0.1.1 // indirect
112115
github.com/opencontainers/go-digest v1.0.0 // indirect
113116
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
114117
github.com/pmezard/go-difflib v1.0.0 // indirect
115118
github.com/prometheus/client_model v0.6.1 // indirect
116119
github.com/prometheus/common v0.62.0 // indirect
117120
github.com/prometheus/procfs v0.15.1 // indirect
118-
github.com/rivo/uniseg v0.4.2 // indirect
121+
github.com/rivo/uniseg v0.4.7 // indirect
119122
github.com/sagikazarmark/locafero v0.11.0 // indirect
120123
github.com/shopspring/decimal v1.4.0 // indirect
121124
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect

go.sum

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
223223
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
224224
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
225225
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
226-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
227-
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
228-
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
226+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
227+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
229228
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
230229
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
231-
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
232-
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
233-
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
230+
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
231+
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
234232
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
235233
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
236234
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
@@ -247,8 +245,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
247245
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
248246
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
249247
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
250-
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
251-
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
248+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc=
249+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0=
250+
github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM=
251+
github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
252+
github.com/olekukonko/ll v0.1.1 h1:9Dfeed5/Mgaxb9lHRAftLK9pVfYETvHn+If6lywVhJc=
253+
github.com/olekukonko/ll v0.1.1/go.mod h1:2dJo+hYZcJMLMbKwHEWvxCUbAOLc/CXWS9noET22Mdo=
254+
github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8=
255+
github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo=
252256
github.com/onsi/ginkgo/v2 v2.25.3 h1:Ty8+Yi/ayDAGtk4XxmmfUy4GabvM+MegeB4cDLRi6nw=
253257
github.com/onsi/ginkgo/v2 v2.25.3/go.mod h1:43uiyQC4Ed2tkOzLsEYm7hnrb7UJTWHYNsuy3bG/snE=
254258
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
@@ -275,8 +279,8 @@ github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkq
275279
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
276280
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
277281
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
278-
github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8=
279-
github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
282+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
283+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
280284
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
281285
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
282286
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
@@ -466,7 +470,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
466470
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
467471
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
468472
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
469-
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
470473
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
471474
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
472475
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=

hack/tools/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ require (
120120
github.com/json-iterator/go v1.1.12 // indirect
121121
github.com/kevinburke/ssh_config v1.2.0 // indirect
122122
github.com/mailru/easyjson v0.7.7 // indirect
123-
github.com/mattn/go-colorable v0.1.13 // indirect
123+
github.com/mattn/go-colorable v0.1.14 // indirect
124124
github.com/mattn/go-isatty v0.0.20 // indirect
125-
github.com/mattn/go-runewidth v0.0.15 // indirect
125+
github.com/mattn/go-runewidth v0.0.16 // indirect
126126
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
127127
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
128128
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
@@ -135,7 +135,7 @@ require (
135135
github.com/prometheus/client_model v0.6.1 // indirect
136136
github.com/prometheus/common v0.62.0 // indirect
137137
github.com/prometheus/procfs v0.15.1 // indirect
138-
github.com/rivo/uniseg v0.4.4 // indirect
138+
github.com/rivo/uniseg v0.4.7 // indirect
139139
github.com/sagikazarmark/locafero v0.11.0 // indirect
140140
github.com/saschagrunert/go-modiff v1.3.5 // indirect
141141
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect

hack/tools/go.sum

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
231231
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
232232
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
233233
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
234-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
235-
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
236-
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
234+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
235+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
237236
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
238237
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
239-
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
240-
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
238+
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
239+
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
241240
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
242241
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
243242
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
@@ -294,8 +293,8 @@ github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkq
294293
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
295294
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
296295
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
297-
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
298-
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
296+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
297+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
299298
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
300299
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
301300
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
@@ -443,7 +442,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
443442
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
444443
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
445444
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
446-
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
447445
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
448446
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
449447
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

internal/util/tree/tree.go

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/fatih/color"
2929
"github.com/gobuffalo/flect"
3030
"github.com/olekukonko/tablewriter"
31+
"github.com/olekukonko/tablewriter/tw"
3132
corev1 "k8s.io/api/core/v1"
3233
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3334
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -65,11 +66,20 @@ var (
6566
// Note: this function is exposed only for usage in clusterctl and Cluster API E2E tests.
6667
func PrintObjectTree(tree *tree.ObjectTree, w io.Writer) {
6768
// Creates the output table
68-
tbl := tablewriter.NewWriter(w)
69-
tbl.SetHeader([]string{"NAME", "REPLICAS", "AVAILABLE", "READY", "UP TO DATE", "STATUS", "REASON", "SINCE", "MESSAGE"})
69+
cfg := getTableTreeConfig()
70+
tbl := tablewriter.NewTable(os.Stdin, tablewriter.WithConfig(cfg), tablewriter.WithRendition(tw.Rendition{ // Apply custom rendition
71+
Settings: tw.Settings{
72+
Separators: tw.SeparatorsNone, Lines: tw.LinesNone,
73+
},
74+
Borders: tw.BorderNone,
75+
}),)
76+
77+
// tbl.SetCenterSeparator("") - rendition - https://github.com/olekukonko/tablewriter/blob/e520aed3bd36fcbc5935d6c4f778c38627788d1d/tw/symbols.go#L885
78+
// tbl.SetRowSeparator("") - rendition - https://github.com/olekukonko/tablewriter/blob/e520aed3bd36fcbc5935d6c4f778c38627788d1d/tw/symbols.go#L885
79+
80+
// tbl := tablewriter.NewWriter(w)
81+
tbl.Header([]string{"NAME", "REPLICAS", "AVAILABLE", "READY", "UP TO DATE", "STATUS", "REASON", "SINCE", "MESSAGE"})
7082

71-
formatTableTree(tbl)
72-
// Add row for the root object, the cluster, and recursively for all the nodes representing the cluster status.
7383
addObjectRow("", tbl, tree, tree.GetRoot())
7484

7585
// Prints the output table
@@ -80,10 +90,21 @@ func PrintObjectTree(tree *tree.ObjectTree, w io.Writer) {
8090
// Note: this function is exposed only for usage in clusterctl and Cluster API E2E tests.
8191
func PrintObjectTreeV1Beta1(tree *tree.ObjectTree) {
8292
// Creates the output table
83-
tbl := tablewriter.NewWriter(os.Stdout)
84-
tbl.SetHeader([]string{"NAME", "READY", "SEVERITY", "REASON", "SINCE", "MESSAGE"})
93+
// tbl := tablewriter.NewWriter(os.Stdout)
94+
cfg := getTableTreeConfig()
95+
tbl := tablewriter.NewTable(os.Stdin, tablewriter.WithConfig(cfg), tablewriter.WithRendition(tw.Rendition{ // Apply custom rendition
96+
Settings: tw.Settings{
97+
Lines: tw.Lines{ShowHeaderLine: tw.Off},
98+
},
99+
Borders: tw.Border{Top: tw.Off, Bottom: tw.Off, Left: tw.Off, Right: tw.Off},
100+
}),)
101+
tbl.Header([]string{"NAME", "READY", "SEVERITY", "REASON", "SINCE", "MESSAGE"})
102+
103+
// tbl.SetRowSeparator("") // different - rendition - https://github.com/olekukonko/tablewriter/blob/e520aed3bd36fcbc5935d6c4f778c38627788d1d/tw/symbols.go#L885
104+
105+
// tbl.SetBorder(false) // different - rendition
85106

86-
formatTableTreeV1Beta1(tbl)
107+
// formatTableTreeV1Beta1(tbl)
87108
// Add row for the root object, the cluster, and recursively for all the nodes representing the cluster status.
88109
addObjectRowV1Beta1("", tbl, tree, tree.GetRoot())
89110

@@ -92,34 +113,37 @@ func PrintObjectTreeV1Beta1(tree *tree.ObjectTree) {
92113
}
93114

94115
// formats the table with required attributes.
95-
func formatTableTree(tbl *tablewriter.Table) {
96-
tbl.SetAutoWrapText(false)
97-
tbl.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
98-
tbl.SetAlignment(tablewriter.ALIGN_LEFT)
99-
100-
tbl.SetCenterSeparator("")
101-
tbl.SetRowSeparator("")
102-
103-
tbl.SetHeaderLine(false)
104-
tbl.SetTablePadding(" ")
105-
tbl.SetNoWhiteSpace(true)
116+
func getTableTreeConfig() (tablewriter.Config) {
117+
cfg := tablewriter.Config{
118+
Row: tw.CellConfig{
119+
Formatting: tw.CellFormatting{AutoWrap: tw.WrapNone},
120+
Alignment: tw.CellAlignment{Global: tw.AlignLeft},
121+
Padding: tw.CellPadding{Global: tw.Padding{Left: " ", Right: " "}},
122+
},
123+
Header: tw.CellConfig{
124+
Alignment: tw.CellAlignment{Global: tw.AlignLeft},
125+
},
126+
Behavior: tw.Behavior{TrimSpace: tw.On},
127+
}
128+
129+
return cfg
106130
}
107131

108-
// formats the table with required attributes.
109-
func formatTableTreeV1Beta1(tbl *tablewriter.Table) {
110-
tbl.SetAutoWrapText(false)
111-
tbl.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
112-
tbl.SetAlignment(tablewriter.ALIGN_LEFT)
113-
114-
tbl.SetCenterSeparator("")
115-
tbl.SetColumnSeparator("")
116-
tbl.SetRowSeparator("")
117-
118-
tbl.SetHeaderLine(false)
119-
tbl.SetBorder(false)
120-
tbl.SetTablePadding(" ")
121-
tbl.SetNoWhiteSpace(true)
122-
}
132+
// // formats the table with required attributes.
133+
// func formatTableTreeV1Beta1(tbl *tablewriter.Table) {
134+
// // tbl.SetAutoWrapText(false)
135+
// // tbl.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
136+
// // tbl.SetAlignment(tablewriter.ALIGN_LEFT)
137+
138+
// // tbl.SetCenterSeparator("")
139+
// // tbl.SetColumnSeparator("")
140+
// // tbl.SetRowSeparator("") // different - rendition
141+
142+
// // tbl.SetHeaderLine(false)
143+
// // tbl.SetBorder(false) // different - rendition
144+
// // tbl.SetTablePadding(" ")
145+
// // tbl.SetNoWhiteSpace(true)
146+
// }
123147

124148
// addObjectRow add a row for a given object, and recursively for all the object's children.
125149
// NOTE: each row name gets a prefix, that generates a tree view like representation.

test/go.mod

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ require (
9797
github.com/json-iterator/go v1.1.12 // indirect
9898
github.com/kylelemons/godebug v1.1.0 // indirect
9999
github.com/mailru/easyjson v0.7.7 // indirect
100-
github.com/mattn/go-colorable v0.1.13 // indirect
100+
github.com/mattn/go-colorable v0.1.14 // indirect
101101
github.com/mattn/go-isatty v0.0.20 // indirect
102-
github.com/mattn/go-runewidth v0.0.14 // indirect
102+
github.com/mattn/go-runewidth v0.0.16 // indirect
103103
github.com/mitchellh/copystructure v1.2.0 // indirect
104104
github.com/mitchellh/reflectwalk v1.0.2 // indirect
105105
github.com/moby/docker-image-spec v1.3.1 // indirect
@@ -110,15 +110,18 @@ require (
110110
github.com/morikuni/aec v1.0.0 // indirect
111111
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
112112
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
113-
github.com/olekukonko/tablewriter v0.0.5 // indirect
113+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
114+
github.com/olekukonko/errors v1.1.0 // indirect
115+
github.com/olekukonko/ll v0.1.1 // indirect
116+
github.com/olekukonko/tablewriter v1.0.9 // indirect
114117
github.com/opencontainers/go-digest v1.0.0 // indirect
115118
github.com/opencontainers/image-spec v1.0.2 // indirect
116119
github.com/pelletier/go-toml v1.9.5 // indirect
117120
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
118121
github.com/pmezard/go-difflib v1.0.0 // indirect
119122
github.com/prometheus/client_model v0.6.1 // indirect
120123
github.com/prometheus/procfs v0.15.1 // indirect
121-
github.com/rivo/uniseg v0.4.2 // indirect
124+
github.com/rivo/uniseg v0.4.7 // indirect
122125
github.com/sagikazarmark/locafero v0.11.0 // indirect
123126
github.com/shopspring/decimal v1.4.0 // indirect
124127
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect

0 commit comments

Comments
 (0)