Skip to content

Commit d0bf4cb

Browse files
Bump github.com/olekukonko/tablewriter from 0.0.5 to 1.1.4 (#322)
* Bump github.com/olekukonko/tablewriter from 0.0.5 to 1.1.4 Bumps [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) from 0.0.5 to 1.1.4. - [Release notes](https://github.com/olekukonko/tablewriter/releases) - [Commits](olekukonko/tablewriter@v0.0.5...v1.1.4) --- updated-dependencies: - dependency-name: github.com/olekukonko/tablewriter dependency-version: 1.1.4 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Fix build errors caused by tablewriter bump to v1.1.4 The v1.1.4 API removed the old setter methods in favour of a configuration-driven approach. Update backups.go to use NewTable (accepts options), Header (variadic), and With* option functions. * Handle errors returned by table.Append and table.Render --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel Graña <dangra@gmail.com>
1 parent fcb2c54 commit d0bf4cb

3 files changed

Lines changed: 51 additions & 30 deletions

File tree

cmd/flexctl/backups.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/fly-apps/postgres-flex/internal/flypg"
1313
"github.com/fly-apps/postgres-flex/internal/flypg/state"
1414
"github.com/olekukonko/tablewriter"
15+
"github.com/olekukonko/tablewriter/tw"
1516
"github.com/spf13/cobra"
1617
)
1718

@@ -199,34 +200,32 @@ func listBackups(cmd *cobra.Command) error {
199200
return fmt.Errorf("failed to get status flag: %v", err)
200201
}
201202

202-
table := tablewriter.NewWriter(os.Stdout)
203-
table.SetHeader([]string{"ID/Name", "Alias", "Status", "End time", "Begin WAL"})
204-
205-
// Set table alignment, borders, padding, etc. as needed
206-
table.SetAlignment(tablewriter.ALIGN_LEFT)
207-
table.SetBorder(true) // Set to false to hide borders
208-
table.SetCenterSeparator("|")
209-
table.SetColumnSeparator("|")
210-
table.SetRowSeparator("-")
211-
table.SetHeaderAlignment(tablewriter.ALIGN_LEFT)
212-
table.SetHeaderLine(true) // Enable header line
213-
table.SetAutoWrapText(false)
203+
table := tablewriter.NewTable(os.Stdout,
204+
tablewriter.WithRowAlignment(tw.AlignLeft),
205+
tablewriter.WithHeaderAlignment(tw.AlignLeft),
206+
tablewriter.WithRowAutoWrap(tw.WrapNone),
207+
)
208+
table.Header("ID/Name", "Alias", "Status", "End time", "Begin WAL")
214209

215210
for _, b := range backupList.Backups {
216211
if filterStatus != "" && b.Status != filterStatus {
217212
continue
218213
}
219214

220-
table.Append([]string{
215+
if err := table.Append([]string{
221216
b.ID,
222217
b.Name,
223218
b.Status,
224219
b.EndTime,
225220
b.BeginWal,
226-
})
221+
}); err != nil {
222+
return fmt.Errorf("failed to append row: %v", err)
223+
}
227224
}
228225

229-
table.Render()
226+
if err := table.Render(); err != nil {
227+
return fmt.Errorf("failed to render table: %v", err)
228+
}
230229

231230
return nil
232231
}

go.mod

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/hashicorp/consul/api v1.18.0
99
github.com/jackc/pgconn v1.14.3
1010
github.com/jackc/pgx/v5 v5.9.1
11-
github.com/olekukonko/tablewriter v0.0.5
11+
github.com/olekukonko/tablewriter v1.1.4
1212
github.com/pkg/errors v0.9.1
1313
github.com/pkg/term v1.1.0
1414
github.com/spf13/cobra v1.10.2
@@ -19,7 +19,10 @@ require (
1919

2020
require (
2121
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
22-
github.com/fatih/color v1.9.0 // indirect
22+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
23+
github.com/clipperhouse/displaywidth v0.10.0 // indirect
24+
github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
25+
github.com/fatih/color v1.18.0 // indirect
2326
github.com/google/go-cmp v0.5.9 // indirect
2427
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
2528
github.com/hashicorp/go-hclog v0.12.0 // indirect
@@ -33,14 +36,17 @@ require (
3336
github.com/jackc/pgpassfile v1.0.0 // indirect
3437
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
3538
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
36-
github.com/mattn/go-colorable v0.1.6 // indirect
37-
github.com/mattn/go-isatty v0.0.12 // indirect
38-
github.com/mattn/go-runewidth v0.0.9 // indirect
39+
github.com/mattn/go-colorable v0.1.14 // indirect
40+
github.com/mattn/go-isatty v0.0.20 // indirect
41+
github.com/mattn/go-runewidth v0.0.19 // indirect
3942
github.com/mitchellh/go-homedir v1.1.0 // indirect
4043
github.com/mitchellh/mapstructure v1.4.1 // indirect
44+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
45+
github.com/olekukonko/errors v1.2.0 // indirect
46+
github.com/olekukonko/ll v0.1.6 // indirect
4147
github.com/spf13/pflag v1.0.9 // indirect
4248
github.com/stretchr/objx v0.5.0 // indirect
4349
golang.org/x/crypto v0.31.0 // indirect
44-
golang.org/x/sys v0.28.0 // indirect
50+
golang.org/x/sys v0.30.0 // indirect
4551
golang.org/x/text v0.29.0 // indirect
4652
)

go.sum

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
44
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
55
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
66
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
7+
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
8+
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
9+
github.com/clipperhouse/displaywidth v0.10.0 h1:GhBG8WuerxjFQQYeuZAeVTuyxuX+UraiZGD4HJQ3Y8g=
10+
github.com/clipperhouse/displaywidth v0.10.0/go.mod h1:XqJajYsaiEwkxOj4bowCTMcT1SgvHo9flfF3jQasdbs=
11+
github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos=
12+
github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
713
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
814
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
915
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1016
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1117
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1218
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
13-
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
1419
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
20+
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
21+
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
1522
github.com/go-chi/chi/v5 v5.2.5 h1:Eg4myHZBjyvJmAFjFvWgrqDTXFyOzjj7YIm3L3mu6Ug=
1623
github.com/go-chi/chi/v5 v5.2.5/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0=
1724
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
@@ -87,16 +94,18 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8794
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
8895
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
8996
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
90-
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
9197
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
98+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
99+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
92100
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
93101
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
94102
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
95103
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
96-
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
97104
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
98-
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
99-
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
105+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
106+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
107+
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
108+
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
100109
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
101110
github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY=
102111
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
@@ -108,8 +117,14 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb
108117
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
109118
github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
110119
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
111-
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
112-
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
120+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc=
121+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0=
122+
github.com/olekukonko/errors v1.2.0 h1:10Zcn4GeV59t/EGqJc8fUjtFT/FuUh5bTMzZ1XwmCRo=
123+
github.com/olekukonko/errors v1.2.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
124+
github.com/olekukonko/ll v0.1.6 h1:lGVTHO+Qc4Qm+fce/2h2m5y9LvqaW+DCN7xW9hsU3uA=
125+
github.com/olekukonko/ll v0.1.6/go.mod h1:NVUmjBb/aCtUpjKk75BhWrOlARz3dqsM+OtszpY4o88=
126+
github.com/olekukonko/tablewriter v1.1.4 h1:ORUMI3dXbMnRlRggJX3+q7OzQFDdvgbN9nVWj1drm6I=
127+
github.com/olekukonko/tablewriter v1.1.4/go.mod h1:+kedxuyTtgoZLwif3P1Em4hARJs+mVnzKxmsCL/C5RY=
113128
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=
114129
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
115130
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -179,8 +194,9 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
179194
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
180195
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
181196
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
182-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
183-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
197+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
198+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
199+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
184200
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
185201
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
186202
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=

0 commit comments

Comments
 (0)