mirror of
https://codeberg.org/scip/anydb.git
synced 2026-10-08 11:14:20 +02:00
update linter config, satisfy linter (#28)
This commit is contained in:
@@ -26,12 +26,12 @@ import (
|
||||
"strings"
|
||||
tpl "text/template"
|
||||
|
||||
"codeberg.org/scip/anydb/app"
|
||||
"codeberg.org/scip/anydb/cfg"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/olekukonko/tablewriter/renderer"
|
||||
"github.com/olekukonko/tablewriter/tw"
|
||||
"codeberg.org/scip/anydb/app"
|
||||
"codeberg.org/scip/anydb/cfg"
|
||||
)
|
||||
|
||||
func List(writer io.Writer, conf *cfg.Config, entries app.DbEntries) error {
|
||||
@@ -54,6 +54,7 @@ func ListJson(writer io.Writer, conf *cfg.Config, entries app.DbEntries) error {
|
||||
}
|
||||
|
||||
fmt.Println(string(jsonentries))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -67,6 +68,7 @@ func ListTemplate(writer io.Writer, conf *cfg.Config, entries app.DbEntries) err
|
||||
|
||||
for _, row := range entries {
|
||||
buf.Reset()
|
||||
|
||||
err = tmpl.Execute(&buf, row)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to execute output template: %w", err)
|
||||
@@ -133,28 +135,27 @@ func ListTable(writer io.Writer, conf *cfg.Config, entries app.DbEntries) error
|
||||
case true:
|
||||
if err :=
|
||||
table.Append([]string{
|
||||
row.Key,
|
||||
strings.Join(row.Tags, ","),
|
||||
strconv.FormatUint(row.Size, 10),
|
||||
row.Created.AsTime().Format("02.01.2006T03:04.05"),
|
||||
row.Preview,
|
||||
row.GetKey(),
|
||||
strings.Join(row.GetTags(), ","),
|
||||
strconv.FormatUint(row.GetSize(), 10),
|
||||
row.GetCreated().AsTime().Format("02.01.2006T03:04.05"),
|
||||
row.GetPreview(),
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to add data to table: %w", err)
|
||||
}
|
||||
default:
|
||||
if err := table.Append([]string{
|
||||
row.Key,
|
||||
strings.Join(row.Tags, ","),
|
||||
humanize.Bytes(uint64(row.Size)),
|
||||
humanize.Time(row.Created.AsTime()),
|
||||
row.Preview,
|
||||
row.GetKey(),
|
||||
strings.Join(row.GetTags(), ","),
|
||||
humanize.Bytes(row.GetSize()),
|
||||
humanize.Time(row.GetCreated().AsTime()),
|
||||
row.GetPreview(),
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to add data to table: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if err := table.Append([]string{row.Key, row.Preview}); err != nil {
|
||||
if err := table.Append([]string{row.GetKey(), row.GetPreview()}); err != nil {
|
||||
return fmt.Errorf("failed to add data to table: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user