feat(tui): paste images and pdfs
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/sst/opencode/internal/styles"
|
||||
"github.com/sst/opencode/internal/theme"
|
||||
"github.com/sst/opencode/internal/util"
|
||||
"golang.design/x/clipboard"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
@@ -146,6 +147,17 @@ func (a *App) Key(commandName commands.CommandName) string {
|
||||
return base(key) + muted(" "+command.Description)
|
||||
}
|
||||
|
||||
func (a *App) SetClipboard(text string) tea.Cmd {
|
||||
var cmds []tea.Cmd
|
||||
cmds = append(cmds, func() tea.Msg {
|
||||
clipboard.Write(clipboard.FmtText, []byte(text))
|
||||
return nil
|
||||
})
|
||||
// try to set the clipboard using OSC52 for terminals that support it
|
||||
cmds = append(cmds, tea.SetClipboard(text))
|
||||
return tea.Sequence(cmds...)
|
||||
}
|
||||
|
||||
func (a *App) InitializeProvider() tea.Cmd {
|
||||
providersResponse, err := a.Client.Config.Providers(context.Background())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user