mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
refactor: NewTable for consistent CLI table rendering, style images for ls,ps
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
NoStyle = lipgloss.NewStyle()
|
||||
|
||||
Faint = lipgloss.NewStyle().Faint(true)
|
||||
Red = lipgloss.NewStyle().Foreground(lipgloss.Red)
|
||||
Green = lipgloss.NewStyle().Foreground(lipgloss.Green)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"charm.land/lipgloss/v2"
|
||||
"charm.land/lipgloss/v2/table"
|
||||
)
|
||||
|
||||
// NewTable creates a borderless table with bold headers and consistent padding for CLI output.
|
||||
func NewTable() *table.Table {
|
||||
return table.New().
|
||||
Border(lipgloss.Border{}).
|
||||
BorderTop(false).
|
||||
BorderBottom(false).
|
||||
BorderLeft(false).
|
||||
BorderRight(false).
|
||||
BorderHeader(false).
|
||||
BorderColumn(false).
|
||||
StyleFunc(func(row, col int) lipgloss.Style {
|
||||
if row == table.HeaderRow {
|
||||
return Bold.PaddingRight(3)
|
||||
}
|
||||
return NoStyle.PaddingRight(3)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user