Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/tui/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ type Item struct {

func builtInSessionCommands() []Item {
return []Item{
{
ID: "session.exit",
Label: "Exit",
SlashCommand: "/exit",
Description: "Exit the application",
Category: "Session",
Execute: func() tea.Cmd {
return core.CmdHandler(messages.ExitSessionMsg{})
},
},
{
ID: "session.new",
Label: "New",
Expand Down
1 change: 1 addition & 0 deletions pkg/tui/messages/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package messages
// Session command messages
type (
NewSessionMsg struct{}
ExitSessionMsg struct{}
EvalSessionMsg struct{ Filename string }
CompactSessionMsg struct{}
CopySessionToClipboardMsg struct{}
Expand Down
5 changes: 5 additions & 0 deletions pkg/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.chatPage = updated.(chat.Page)
return a, cmd

case messages.ExitSessionMsg:
return a, core.CmdHandler(dialog.OpenDialogMsg{
Model: dialog.NewExitConfirmationDialog(),
})

case messages.NewSessionMsg:
a.application.NewSession()
sess := a.application.Session()
Expand Down