Skip to content

Commit 57075cc

Browse files
committed
Use varargs
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent c59ae6e commit 57075cc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pkg/tui/components/sidebar/queue_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestQueueSection_SingleMessage(t *testing.T) {
1616
sessionState := &service.SessionState{}
1717
m := New(sessionState).(*model)
1818

19-
m.SetQueuedMessages([]string{"Hello world"})
19+
m.SetQueuedMessages("Hello world")
2020

2121
result := m.queueSection(40)
2222

@@ -39,7 +39,7 @@ func TestQueueSection_MultipleMessages(t *testing.T) {
3939
sessionState := &service.SessionState{}
4040
m := New(sessionState).(*model)
4141

42-
m.SetQueuedMessages([]string{"First", "Second", "Third"})
42+
m.SetQueuedMessages("First", "Second", "Third")
4343

4444
result := m.queueSection(40)
4545

@@ -67,7 +67,7 @@ func TestQueueSection_LongMessageTruncation(t *testing.T) {
6767

6868
// Create a very long message
6969
longMessage := strings.Repeat("x", 100)
70-
m.SetQueuedMessages([]string{longMessage})
70+
m.SetQueuedMessages(longMessage)
7171

7272
result := m.queueSection(30) // Narrow width to force truncation
7373

@@ -91,7 +91,7 @@ func TestQueueSection_InRenderSections(t *testing.T) {
9191
assert.NotContains(t, outputWithoutQueue, "Queue")
9292

9393
// With queued messages, queue section should appear
94-
m.SetQueuedMessages([]string{"Pending task"})
94+
m.SetQueuedMessages("Pending task")
9595
linesWithQueue := m.renderSections(35)
9696
outputWithQueue := strings.Join(linesWithQueue, "\n")
9797
assert.Contains(t, outputWithQueue, "Queue (1)")

pkg/tui/components/sidebar/sidebar.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type Model interface {
4949
SetAgentSwitching(switching bool)
5050
SetToolsetInfo(availableTools int, loading bool)
5151
SetSessionStarred(starred bool)
52-
SetQueuedMessages(messages []string)
52+
SetQueuedMessages(messages ...string)
5353
GetSize() (width, height int)
5454
LoadFromSession(sess *session.Session)
5555
// HandleClick checks if click is on the star and returns true if handled
@@ -192,8 +192,8 @@ func (m *model) SetSessionStarred(starred bool) {
192192
}
193193

194194
// SetQueuedMessages sets the list of queued message previews to display
195-
func (m *model) SetQueuedMessages(messages []string) {
196-
m.queuedMessages = messages
195+
func (m *model) SetQueuedMessages(queuedMessages ...string) {
196+
m.queuedMessages = queuedMessages
197197
}
198198

199199
// HandleClick checks if click is on the star and returns true if it was

pkg/tui/page/chat/chat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ func (p *chatPage) syncQueueToSidebar() {
685685
}
686686
previews[i] = content
687687
}
688-
p.sidebar.SetQueuedMessages(previews)
688+
p.sidebar.SetQueuedMessages(previews...)
689689
}
690690

691691
// processMessage processes a message with the runtime

0 commit comments

Comments
 (0)