Render all tables the same way

This commit is contained in:
Finn 2021-02-06 01:13:55 -08:00
parent 8b7269ae09
commit 087e096e60
11 changed files with 16 additions and 9 deletions

View file

@ -68,7 +68,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
case common.OutputFormatQR, common.OutputFormatDefault: case common.OutputFormatQR, common.OutputFormatDefault:

View file

@ -78,7 +78,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -60,7 +60,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -73,7 +73,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -81,7 +81,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -77,7 +77,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -112,7 +112,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
} }

View file

@ -117,7 +117,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -108,7 +108,7 @@ var (
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
t.SetStyle(table.StyleLight) common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -67,6 +67,7 @@ var versionCmd = &cobra.Command{
if common.OutputFormat == common.OutputFormatCSV { if common.OutputFormat == common.OutputFormatCSV {
t.RenderCSV() t.RenderCSV()
} else { } else {
common.StylizeTable(t)
t.Render() t.Render()
} }
default: default:

View file

@ -3,6 +3,8 @@ package common
import ( import (
"log" "log"
"github.com/jedib0t/go-pretty/v6/table"
"gitlab.com/signald/signald-go/signald" "gitlab.com/signald/signald-go/signald"
) )
@ -30,3 +32,7 @@ func Must(err error) {
log.Fatal(err) log.Fatal(err)
} }
} }
func StylizeTable(t table.Writer) {
t.SetStyle(table.StyleLight)
}