Skip to content

コミットメッセージの複数選択をTUIで可能にする #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 3, 2023
Prev Previous commit
Next Next commit
Fix commit error message and add suggested commit message options
  • Loading branch information
{cocoide} committed Sep 2, 2023
commit 108f7e64bf66a1ef5daebfbb47744fa198070a5f
7 changes: 3 additions & 4 deletions cmd/suggest.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case tea.KeyEnter:
if err := util.ExecCommitMessage(m.choices[m.currentIdx]); err != nil {
m.errorMsg = err.Error()
return m, nil
m.errorMsg = "コミットエラーが発生"
return m, tea.Quit
}
return m, tea.Quit
case tea.KeyCtrlC, tea.KeyEsc:
Expand All @@ -52,7 +52,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (m model) View() string {
var b strings.Builder
if m.errorMsg != "" {
// エラーメッセージを赤色で表示
red := color.New(color.FgRed).SprintFunc()
b.WriteString(red(m.errorMsg) + "\n\n")
}
Expand Down Expand Up @@ -86,7 +85,7 @@ var suggestCmd = &cobra.Command{
}
suggestMsg := <-msgCh
fmt.Println(suggestMsg)
choices := []string{"32", "!", "!#!"}
choices := []string{suggestMsg, "!", "!#!"}
m := model{choices: choices}
p := tea.NewProgram(m)
p.Run()
Expand Down