Skip to content

Commit 5c6f192

Browse files
committed
feat: TUI 'c' shortcut opens editor and defaults to draft status
- Open new bean in $EDITOR immediately after creation - Default new beans created via TUI to "draft" status
1 parent 8fd3d29 commit 5c6f192

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: 'TUI: open editor after creating bean with ''c'''
3+
status: completed
4+
type: feature
5+
priority: normal
6+
created_at: 2025-12-13T02:47:02Z
7+
updated_at: 2025-12-13T02:47:50Z
8+
---
9+
10+
When creating a new bean in the TUI using the 'c' shortcut, automatically open it in $EDITOR after creation, similar to how 'e' works for editing existing beans. This gives users an immediate way to add a description/body to new beans.

internal/tui/tui.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,18 +374,25 @@ func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
374374
return a, nil
375375

376376
case beanCreatedMsg:
377-
// Create the bean via GraphQL mutation
378-
_, err := a.resolver.Mutation().CreateBean(context.Background(), model.CreateBeanInput{
379-
Title: msg.title,
377+
// Create the bean via GraphQL mutation with draft status
378+
draftStatus := "draft"
379+
createdBean, err := a.resolver.Mutation().CreateBean(context.Background(), model.CreateBeanInput{
380+
Title: msg.title,
381+
Status: &draftStatus,
380382
})
381383
if err != nil {
382384
// TODO: Show error to user
383385
a.state = a.previousState
384386
return a, nil
385387
}
386-
// Return to list and refresh
388+
// Return to list and open the new bean in editor
387389
a.state = viewList
388-
return a, a.list.loadBeans
390+
return a, tea.Batch(
391+
a.list.loadBeans,
392+
func() tea.Msg {
393+
return openEditorMsg{beanID: createdBean.ID, beanPath: createdBean.Path}
394+
},
395+
)
389396

390397
case openEditorMsg:
391398
// Launch editor for the bean file

0 commit comments

Comments
 (0)