Skip to content

Commit 14d5afe

Browse files
committed
loading完成
1 parent 1a812de commit 14d5afe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/suggest.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type model struct {
1818
currentIdx int
1919
errorMsg string
2020
isLoading bool
21+
animationIdx int
2122
messages []string
2223
}
2324

@@ -70,6 +71,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7071
case tea.KeyCtrlC, tea.KeyEsc:
7172
return m, tea.Quit
7273
}
74+
case tea.Cmd:
75+
if m.isLoading {
76+
m.animationIdx = (m.animationIdx + 1) % 3
77+
}
7378
}
7479
return m, nil
7580
}
@@ -80,7 +85,9 @@ func (m model) View() string {
8085
return fmt.Sprintf(red(m.errorMsg))
8186
}
8287
if m.isLoading {
83-
return "🌎 Generating commit messages ..."
88+
AnimationEarth := []string{"🌎","🌍","🌏"}
89+
AnimationPoint := []string{".","..","..."}
90+
return fmt.Sprintf("%s Generating commit messages %s", AnimationEarth[m.animationIdx], AnimationPoint[m.animationIdx])
8491
}
8592
var b strings.Builder
8693
if m.errorMsg != "" {

0 commit comments

Comments
 (0)