Adjust to new tablewriter release

This commit is contained in:
Ralf Haferkamp
2025-05-19 19:26:38 +02:00
parent 70fc6eb40b
commit 96684df32d
36 changed files with 168 additions and 147 deletions
@@ -14,7 +14,8 @@ import (
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/mohae/deepcopy"
tw "github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/tw"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
zlog "github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/config"
@@ -469,11 +470,10 @@ func itemType(it provider.ResourceType) string {
return itemType
}
func itemsTable(total int) *tw.Table {
table := tw.NewWriter(os.Stdout)
table.SetHeader([]string{"itemID", "path", "type", "delete at"})
table.SetAutoFormatHeaders(false)
table.SetFooter([]string{"", "", "", "total count: " + strconv.Itoa(total)})
func itemsTable(total int) *tablewriter.Table {
table := tablewriter.NewTable(os.Stdout, tablewriter.WithHeaderAutoFormat(tw.Off))
table.Header([]string{"itemID", "path", "type", "delete at"})
table.Footer([]string{"", "", "", "total count: " + strconv.Itoa(total)})
return table
}
@@ -9,7 +9,8 @@ import (
"strings"
"time"
tw "github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/tw"
"github.com/urfave/cli/v2"
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
@@ -145,16 +146,15 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
}
var (
table *tw.Table
table *tablewriter.Table
raw []Session
)
if !c.Bool("json") {
fmt.Println(buildInfo(filter))
table = tw.NewWriter(os.Stdout)
table.SetHeader([]string{"Space", "Upload Id", "Name", "Offset", "Size", "Executant", "Owner", "Expires", "Processing", "Scan Date", "Scan Result"})
table.SetAutoFormatHeaders(false)
table = tablewriter.NewTable(os.Stdout, tablewriter.WithHeaderAutoFormat(tw.Off))
table.Header([]string{"Space", "Upload Id", "Name", "Offset", "Size", "Executant", "Owner", "Expires", "Processing", "Scan Date", "Scan Result"})
}
for _, u := range uploads {
@@ -7,7 +7,8 @@ import (
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/version"
tw "github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter"
"github.com/olekukonko/tablewriter/tw"
"github.com/opencloud-eu/opencloud/services/storage-users/pkg/config"
"github.com/urfave/cli/v2"
)
@@ -35,9 +36,8 @@ func Version(cfg *config.Config) *cli.Command {
return nil
}
table := tw.NewWriter(os.Stdout)
table.SetHeader([]string{"Version", "Address", "Id"})
table.SetAutoFormatHeaders(false)
table := tablewriter.NewTable(os.Stdout, tablewriter.WithHeaderAutoFormat(tw.Off))
table.Header([]string{"Version", "Address", "Id"})
for _, s := range services {
for _, n := range s.Nodes {
table.Append([]string{s.Version, n.Address, n.Id})