mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
refactor: NewTable for consistent CLI table rendering, style images for ls,ps
This commit is contained in:
1 parent
9aee75ba28
commit
e22cdf0b18
6 files changed
+35
-41
No files matched your search
@@ -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