From b44b8ffca67c2a89db076f0284b003db235c302b Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Sat, 18 Apr 2020 17:13:03 +0300 Subject: [PATCH] Add A Method To Draw Simplistic Tables --- views/users.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/views/users.go b/views/users.go index 6f8272b..cecbee0 100644 --- a/views/users.go +++ b/views/users.go @@ -59,3 +59,20 @@ func ViewUsersTable(users []*auth.ExportedUserRecord, nextPageToken string) { os.Exit(1) } } + +type TableUI interface { + AddLine(args ...interface{}) + AddHeader(args ...interface{}) + Print() +} + +// SimpleTable returns a simple no interactable table to be printed to the terminal +func SimpleTableList(t TableUI, headers []interface{}, rows ...[]interface{}) TableUI { + if headers != nil { + t.AddHeader(headers...) + } + for _, v := range rows { + t.AddLine(v...) + } + return t +}