From 087e096e6095ccb3b89fca474165baa6220167cc Mon Sep 17 00:00:00 2001 From: Finn Date: Sat, 6 Feb 2021 01:13:55 -0800 Subject: [PATCH] Render all tables the same way --- cmd/signaldctl/cmd/account/link/link-account.go | 2 +- cmd/signaldctl/cmd/account/list/list-accounts.go | 2 +- cmd/signaldctl/cmd/config/get/get-config.go | 2 +- cmd/signaldctl/cmd/device/list/list.go | 2 +- .../cmd/group/accept/accept-invitation-to-group.go | 2 +- cmd/signaldctl/cmd/group/list/list-group.go | 2 +- cmd/signaldctl/cmd/group/show/show-group.go | 2 +- cmd/signaldctl/cmd/message/react/react-to-message.go | 2 +- cmd/signaldctl/cmd/message/send/send-message.go | 2 +- cmd/signaldctl/cmd/version.go | 1 + cmd/signaldctl/common/signald.go | 6 ++++++ 11 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmd/signaldctl/cmd/account/link/link-account.go b/cmd/signaldctl/cmd/account/link/link-account.go index 992fd88..6a639f7 100644 --- a/cmd/signaldctl/cmd/account/link/link-account.go +++ b/cmd/signaldctl/cmd/account/link/link-account.go @@ -68,7 +68,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } case common.OutputFormatQR, common.OutputFormatDefault: diff --git a/cmd/signaldctl/cmd/account/list/list-accounts.go b/cmd/signaldctl/cmd/account/list/list-accounts.go index 6ec1112..6b44feb 100644 --- a/cmd/signaldctl/cmd/account/list/list-accounts.go +++ b/cmd/signaldctl/cmd/account/list/list-accounts.go @@ -78,7 +78,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/config/get/get-config.go b/cmd/signaldctl/cmd/config/get/get-config.go index 570b7e3..25ea1a8 100644 --- a/cmd/signaldctl/cmd/config/get/get-config.go +++ b/cmd/signaldctl/cmd/config/get/get-config.go @@ -60,7 +60,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/device/list/list.go b/cmd/signaldctl/cmd/device/list/list.go index b12b617..be433e9 100644 --- a/cmd/signaldctl/cmd/device/list/list.go +++ b/cmd/signaldctl/cmd/device/list/list.go @@ -73,7 +73,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/group/accept/accept-invitation-to-group.go b/cmd/signaldctl/cmd/group/accept/accept-invitation-to-group.go index db73494..3ba6265 100644 --- a/cmd/signaldctl/cmd/group/accept/accept-invitation-to-group.go +++ b/cmd/signaldctl/cmd/group/accept/accept-invitation-to-group.go @@ -81,7 +81,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/group/list/list-group.go b/cmd/signaldctl/cmd/group/list/list-group.go index 9f406e9..b1ac079 100644 --- a/cmd/signaldctl/cmd/group/list/list-group.go +++ b/cmd/signaldctl/cmd/group/list/list-group.go @@ -77,7 +77,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/group/show/show-group.go b/cmd/signaldctl/cmd/group/show/show-group.go index 44daa65..47f2415 100644 --- a/cmd/signaldctl/cmd/group/show/show-group.go +++ b/cmd/signaldctl/cmd/group/show/show-group.go @@ -112,7 +112,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } } diff --git a/cmd/signaldctl/cmd/message/react/react-to-message.go b/cmd/signaldctl/cmd/message/react/react-to-message.go index 2616f7d..9abc9e9 100644 --- a/cmd/signaldctl/cmd/message/react/react-to-message.go +++ b/cmd/signaldctl/cmd/message/react/react-to-message.go @@ -117,7 +117,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/message/send/send-message.go b/cmd/signaldctl/cmd/message/send/send-message.go index dd8d5cb..d274bda 100644 --- a/cmd/signaldctl/cmd/message/send/send-message.go +++ b/cmd/signaldctl/cmd/message/send/send-message.go @@ -108,7 +108,7 @@ var ( if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { - t.SetStyle(table.StyleLight) + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/cmd/version.go b/cmd/signaldctl/cmd/version.go index 9510c43..e4fed3d 100644 --- a/cmd/signaldctl/cmd/version.go +++ b/cmd/signaldctl/cmd/version.go @@ -67,6 +67,7 @@ var versionCmd = &cobra.Command{ if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { + common.StylizeTable(t) t.Render() } default: diff --git a/cmd/signaldctl/common/signald.go b/cmd/signaldctl/common/signald.go index 1b2ffa3..877b433 100644 --- a/cmd/signaldctl/common/signald.go +++ b/cmd/signaldctl/common/signald.go @@ -3,6 +3,8 @@ package common import ( "log" + "github.com/jedib0t/go-pretty/v6/table" + "gitlab.com/signald/signald-go/signald" ) @@ -30,3 +32,7 @@ func Must(err error) { log.Fatal(err) } } + +func StylizeTable(t table.Writer) { + t.SetStyle(table.StyleLight) +}