refactor: make SetHeaders variadic

This commit is contained in:
bashbunni
2024-09-11 17:12:22 -07:00
parent 7b5c6cbcb2
commit 2e34a232d2
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -339,7 +339,8 @@ func rowToString(rows []Row) [][]string {
}
// 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.table.Headers(headers...)
}
+1 -1
View File
@@ -13,7 +13,7 @@ func TestFromValues(t *testing.T) {
t.Run("Headers", func(t *testing.T) {
input := "foo1,bar1\nfoo2,bar2\nfoo3,bar3"
table := New()
table.Headers("Foo", "Bar")
table.SetHeaders("Foo", "Bar")
table.FromValues(input, ",")
if len(table.rows) != 3 {