@@ -2,8 +2,8 @@ package model
22
33import (
44 "fmt"
5− "log/slog"
65 "strings"
6+ "time"
77
88 "charm.land/bubbles/v2/key"
99 tea "charm.land/bubbletea/v2"
@@ -14,14 +14,18 @@ import (
1414 "github.com/charmbracelet/crush/internal/ui/util"
1515)
1616
17−// markProjectInitialized marks the current project as initialized in the config.
18−func (m *UI) markProjectInitialized() tea.Msg {
19− // TODO: handle error so we show it in the tui footer
20− err := m.com.Workspace.MarkProjectInitialized()
21− if err != nil {
22− slog.Error(err.Error())
17+// markProjectInitializedCmd marks the current project as initialized in the config.
18+func (m *UI) markProjectInitializedCmd() tea.Cmd {
19+ return func() tea.Msg {
20+ if err := m.com.Workspace.MarkProjectInitialized(); err != nil {
21+ return util.InfoMsg{
22+ Type: util.InfoTypeError,
23+ Msg: fmt.Sprintf("Failed to mark project as initialized: %v", err),
24+ TTL: 15 * time.Second,
25+ }
26+ }
27+ return nil
2328 }
24− return nil
2529}
2630
2731// updateInitializeView handles keyboard input for the project initialization prompt.
@@ -61,7 +65,7 @@ func (m *UI) initializeProject() tea.Cmd {
6165 return sendMessageMsg{Content: initPrompt}
6266 }
6367 // Mark the project as initialized
64− cmds = append(cmds, initialize, m.markProjectInitialized)
68+ cmds = append(cmds, initialize, m.markProjectInitializedCmd())
6569
6670 return tea.Sequence(cmds...)
6771}
@@ -71,7 +75,7 @@ func (m *UI) skipInitializeProject() tea.Cmd {
7175 // TODO: initialize the project
7276 m.setState(uiLanding, uiFocusEditor)
7377 // mark the project as initialized
74− return m.markProjectInitialized
78+ return m.markProjectInitializedCmd()
7579}
7680
7781// initializeView renders the project initialization prompt with Yes/No buttons.