summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/page/chat.go
diff options
context:
space:
mode:
authorEd Zynda <[email protected]>2025-05-15 16:52:24 +0300
committeradamdottv <[email protected]>2025-05-15 09:43:33 -0500
commitab150be7c393a91d9fb2347b7012ad2f7d77700b (patch)
treef83cc39853f73d62227121af27739d1c310e02e6 /internal/tui/page/chat.go
parenta203fb8cccf45d74fb217bdc579155ee058af248 (diff)
downloadopencode-ab150be7c393a91d9fb2347b7012ad2f7d77700b.tar.gz
opencode-ab150be7c393a91d9fb2347b7012ad2f7d77700b.zip
feat: Support named arguments in custom commands (#158)
* Allow multiple named args * fix: Fix styling in multi-arguments dialog * Remove old unused modal * Focus on only one input at a time
Diffstat (limited to 'internal/tui/page/chat.go')
-rw-r--r--internal/tui/page/chat.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/tui/page/chat.go b/internal/tui/page/chat.go
index ece36b59a..1b31c838c 100644
--- a/internal/tui/page/chat.go
+++ b/internal/tui/page/chat.go
@@ -3,6 +3,7 @@ package page
import (
"context"
"fmt"
+ "strings"
"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
@@ -81,8 +82,19 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
status.Warn("Agent is busy, please wait before executing a command...")
return p, nil
}
+
+ // Process the command content with arguments if any
+ content := msg.Content
+ if msg.Args != nil {
+ // Replace all named arguments with their values
+ for name, value := range msg.Args {
+ placeholder := "$" + name
+ content = strings.ReplaceAll(content, placeholder, value)
+ }
+ }
+
// Handle custom command execution
- cmd := p.sendMessage(msg.Content, nil)
+ cmd := p.sendMessage(content, nil)
if cmd != nil {
return p, cmd
}