diff options
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()) |
