forked from toolshed/abra
Introduce a JSON output table mechanic
- Create JSONTable as a proxy/extension to tablewriter which can also output JSON. - Implement machine readable output for `server list` and `recipe list`
This commit is contained in:
@ -6,7 +6,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
// "github.com/olekukonko/tablewriter"
|
||||
"coopcloud.tech/abra/pkg/jsontable"
|
||||
"github.com/schollz/progressbar/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -32,8 +33,8 @@ func HumanDuration(timestamp int64) string {
|
||||
}
|
||||
|
||||
// CreateTable prepares a table layout for output.
|
||||
func CreateTable(columns []string) *tablewriter.Table {
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
func CreateTable(columns []string) *jsontable.JSONTable {
|
||||
table := jsontable.NewJSONTable(os.Stdout)
|
||||
table.SetAutoWrapText(false)
|
||||
table.SetHeader(columns)
|
||||
return table
|
||||
|
Reference in New Issue
Block a user