mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
refactor: make SetHeaders variadic
This commit is contained in:
+2
-1
@@ -339,7 +339,8 @@ func rowToString(rows []Row) [][]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetHeaders sets the table headers.
|
// SetHeaders sets the table headers.
|
||||||
func (m *Model) SetHeaders(headers []string) {
|
// TODO should this be variadic to match lipgloss table?
|
||||||
|
func (m *Model) SetHeaders(headers ...string) {
|
||||||
m.headers = headers
|
m.headers = headers
|
||||||
m.table.Headers(headers...)
|
m.table.Headers(headers...)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ func TestFromValues(t *testing.T) {
|
|||||||
t.Run("Headers", func(t *testing.T) {
|
t.Run("Headers", func(t *testing.T) {
|
||||||
input := "foo1,bar1\nfoo2,bar2\nfoo3,bar3"
|
input := "foo1,bar1\nfoo2,bar2\nfoo3,bar3"
|
||||||
table := New()
|
table := New()
|
||||||
table.Headers("Foo", "Bar")
|
table.SetHeaders("Foo", "Bar")
|
||||||
table.FromValues(input, ",")
|
table.FromValues(input, ",")
|
||||||
|
|
||||||
if len(table.rows) != 3 {
|
if len(table.rows) != 3 {
|
||||||
|
|||||||
Reference in New Issue
Block a user