0
0
forked from toolshed/abra

refactor: tablewriter -> lipgloss

Also the jsontable impl. is dropped also. Output is unchanged.
This commit is contained in:
2024-07-16 16:22:47 +02:00
parent f28cffe6d8
commit de006782b6
18 changed files with 383 additions and 444 deletions

View File

@ -56,9 +56,15 @@ var appServicesCommand = cli.Command{
log.Fatal(err)
}
tableCol := []string{"service name", "image"}
table := formatter.CreateTable(tableCol)
table, err := formatter.CreateTable2()
if err != nil {
log.Fatal(err)
}
headers := []string{"SERVICE (SHORT)", "SERVICE (LONG)", "IMAGE"}
table.Headers(headers...)
var rows [][]string
for _, container := range containers {
var containerNames []string
for _, containerName := range container.Names {
@ -69,14 +75,20 @@ var appServicesCommand = cli.Command{
serviceShortName := service.ContainerToServiceName(container.Names, app.StackName())
serviceLongName := fmt.Sprintf("%s_%s", app.StackName(), serviceShortName)
tableRow := []string{
row := []string{
serviceShortName,
serviceLongName,
formatter.RemoveSha(container.Image),
}
table.Append(tableRow)
rows = append(rows, row)
}
table.Render()
table.Rows(rows...)
if len(rows) > 0 {
fmt.Println(table)
}
return nil
},