summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/attachment
diff options
context:
space:
mode:
authorplyght <[email protected]>2025-07-21 17:31:29 +0200
committerGitHub <[email protected]>2025-07-21 10:31:29 -0500
commit4b2e52c834680301556ad103f7cd885071b8df6e (patch)
tree6e8cac5cbde5a9590b3fef4cee6cfe28cfbf3922 /packages/tui/internal/attachment
parent6867658c0ff7b6d9d1d167ff8394c135b740877c (diff)
downloadopencode-4b2e52c834680301556ad103f7cd885071b8df6e.tar.gz
opencode-4b2e52c834680301556ad103f7cd885071b8df6e.zip
feat(tui): paste minimizing (#784)
Co-authored-by: adamdotdevin <[email protected]>
Diffstat (limited to 'packages/tui/internal/attachment')
-rw-r--r--packages/tui/internal/attachment/attachment.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/tui/internal/attachment/attachment.go b/packages/tui/internal/attachment/attachment.go
index 178de9954..26bb91d49 100644
--- a/packages/tui/internal/attachment/attachment.go
+++ b/packages/tui/internal/attachment/attachment.go
@@ -4,6 +4,10 @@ import (
"github.com/google/uuid"
)
+type TextSource struct {
+ Value string `toml:"value"`
+}
+
type FileSource struct {
Path string `toml:"path"`
Mime string `toml:"mime"`
@@ -46,6 +50,14 @@ func NewAttachment() *Attachment {
}
}
+func (a *Attachment) GetTextSource() (*TextSource, bool) {
+ if a.Type != "text" {
+ return nil, false
+ }
+ ts, ok := a.Source.(*TextSource)
+ return ts, ok
+}
+
// GetFileSource returns the source as FileSource if the attachment is a file type
func (a *Attachment) GetFileSource() (*FileSource, bool) {
if a.Type != "file" {