diff options
| author | adamdottv <[email protected]> | 2025-07-02 16:08:06 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-07-02 16:08:11 -0500 |
| commit | c82a060eca41b990b4dd89cecffb874b2133af6f (patch) | |
| tree | c3bb84aee2e621da9feb18f866c88fc51da0e7c1 /packages/tui/internal/app | |
| parent | 63e783ef795d91c745733b945247e917f1683d31 (diff) | |
| download | opencode-c82a060eca41b990b4dd89cecffb874b2133af6f.tar.gz opencode-c82a060eca41b990b4dd89cecffb874b2133af6f.zip | |
feat(tui): file viewer, select messages
Diffstat (limited to 'packages/tui/internal/app')
| -rw-r--r-- | packages/tui/internal/app/app.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 2369b196a..9b341c19b 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -20,9 +20,6 @@ import ( "github.com/sst/opencode/internal/util" ) -var RootPath string -var CwdPath string - type App struct { Info opencode.App Version string @@ -38,6 +35,7 @@ type App struct { } type SessionSelectedMsg = *opencode.Session +type SessionLoadedMsg struct{} type ModelSelectedMsg struct { Provider opencode.Provider Model opencode.Model @@ -54,6 +52,9 @@ type CompletionDialogTriggeredMsg struct { type OptimisticMessageAddedMsg struct { Message opencode.Message } +type FileRenderedMsg struct { + FilePath string +} func New( ctx context.Context, @@ -61,8 +62,8 @@ func New( appInfo opencode.App, httpClient *opencode.Client, ) (*App, error) { - RootPath = appInfo.Path.Root - CwdPath = appInfo.Path.Cwd + util.RootPath = appInfo.Path.Root + util.CwdPath = appInfo.Path.Cwd configInfo, err := httpClient.Config.Get(ctx) if err != nil { @@ -125,6 +126,19 @@ func New( return app, nil } +func (a *App) Key(commandName commands.CommandName) string { + t := theme.CurrentTheme() + base := styles.NewStyle().Background(t.Background()).Foreground(t.Text()).Bold(true).Render + muted := styles.NewStyle().Background(t.Background()).Foreground(t.TextMuted()).Faint(true).Render + command := a.Commands[commandName] + kb := command.Keybindings[0] + key := kb.Key + if kb.RequiresLeader { + key = a.Config.Keybinds.Leader + " " + kb.Key + } + return base(key) + muted(" "+command.Description) +} + func (a *App) InitializeProvider() tea.Cmd { return func() tea.Msg { providersResponse, err := a.Client.Config.Providers(context.Background()) |
