Skip to content

Commit c6d35f8

Browse files
author
{cocoide}
committed
Merge branch 'develop' of https://github.com/cocoide/commitify into develop
2 parents 9fa372a + dd1dbd3 commit c6d35f8

File tree

6 files changed

+17
-39
lines changed

6 files changed

+17
-39
lines changed

.github/workflows/release.yml

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ jobs:
1515
with:
1616
fetch-depth: 0 # Changelog を正しく動作させるために必要
1717

18-
- name: Install GoReleaser and mockgen
19-
run: go get github.com/golang/mock/mockgen
20-
env:
21-
GO111MODULE: on
2218
# Go をセットアップ
2319
- uses: actions/setup-go@v3
2420
with:

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.PHONY: test
22

33
test:
4-
go generate ./...
54
go test -v ./internal/service

cmd/config.go

+10-17
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,14 @@ func (cm configModel) View() string {
127127
switch cm.configKeySelected {
128128
// 設定項目を選んでいない時
129129
case false:
130-
white := color.New(color.FgWhite).SprintFunc()
131-
b.WriteString(white("設定項目を選んでください:\n"))
132-
b.WriteString(white(" ↑↓の矢印キーで項目を移動、Enterで選択\n"))
130+
b.WriteString(color.WhiteString("設定項目を選んでください:\n"))
131+
b.WriteString(color.WhiteString(" ↑↓の矢印キーで項目を移動、Enterで選択\n"))
133132

134133
for i, choice := range configKey {
135-
cyan := color.New(color.FgCyan).SprintFunc()
136-
hiCyan := color.New(color.FgHiCyan).SprintFunc()
137134
if i == cm.configKeyIndex {
138-
b.WriteString(fmt.Sprintf(hiCyan("➡️ %s\n"), choice))
135+
b.WriteString(fmt.Sprintf(color.HiCyanString("➡️ %s\n"), choice))
139136
} else {
140-
b.WriteString(fmt.Sprintf(cyan(" %s\n"), choice))
137+
b.WriteString(fmt.Sprintf(color.CyanString(" %s\n"), choice))
141138
}
142139
}
143140

@@ -146,26 +143,22 @@ func (cm configModel) View() string {
146143
// 選択肢のない項目はテキストエリアを表示
147144
switch len(configOption[cm.configKeyIndex]) {
148145
case 0:
149-
white := color.New(color.FgWhite).SprintFunc()
150-
b.WriteString(white(fmt.Sprintf(
146+
b.WriteString(color.WhiteString(fmt.Sprintf(
151147
"ここに%sを入力: %s\n",
152148
configKey[cm.configKeyIndex],
153149
cm.textInput.View(),
154150
)))
155-
b.WriteString(white(" Enterキーで確定"))
151+
b.WriteString(color.WhiteString(" Enterキーで確定"))
156152

157153
default:
158-
white := color.New(color.FgWhite).SprintFunc()
159-
b.WriteString(white("設定内容を選んでください:\n"))
160-
b.WriteString(white(" ↑↓の矢印キーで項目を移動、Enterで選択\n"))
154+
b.WriteString(color.WhiteString("設定内容を選んでください:\n"))
155+
b.WriteString(color.WhiteString(" ↑↓の矢印キーで項目を移動、Enterで選択\n"))
161156

162157
for i, option := range configOptionLabel[cm.configKeyIndex] {
163-
cyan := color.New(color.FgCyan).SprintFunc()
164-
hiCyan := color.New(color.FgHiCyan).SprintFunc()
165158
if i == cm.configOptionIndex {
166-
b.WriteString(fmt.Sprintf(hiCyan("➡️ %s\n"), option))
159+
b.WriteString(fmt.Sprintf(color.HiCyanString("➡️ %s\n"), option))
167160
} else {
168-
b.WriteString(fmt.Sprintf(cyan(" %s\n"), option))
161+
b.WriteString(fmt.Sprintf(color.CyanString(" %s\n"), option))
169162
}
170163
}
171164
}

cmd/docs.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Copyright © 2023 NAME HERE <EMAIL ADDRESS>
44
package cmd
55

66
import (
7-
"fmt"
8-
97
"github.com/cocoide/commitify/static"
108
"github.com/fatih/color"
119
"github.com/spf13/cobra"
@@ -17,9 +15,7 @@ var docsCmd = &cobra.Command{
1715
Short: "Document of commitify",
1816
Run: func(cmd *cobra.Command, args []string) {
1917
b, _ := static.Logo.ReadFile("logo.txt")
20-
cyan := color.New(color.FgCyan).SprintFunc()
21-
logo := cyan(string(b))
22-
fmt.Println(logo)
18+
color.Cyan(string(b))
2319
},
2420
}
2521

cmd/suggest.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,23 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7373

7474
func (m *model) View() string {
7575
if m.errorMsg != "" {
76-
red := color.New(color.FgRed).SprintFunc()
77-
return fmt.Sprintf(red(m.errorMsg))
76+
return color.RedString(m.errorMsg)
7877
}
7978
if m.isLoading {
8079
return "🌎 Generating commit messages ..."
8180
}
8281
var b strings.Builder
8382
if m.errorMsg != "" {
84-
red := color.New(color.FgRed).SprintFunc()
85-
b.WriteString(red(m.errorMsg) + "\n\n")
83+
b.WriteString(color.RedString(m.errorMsg) + "\n\n")
8684
}
87-
white := color.New(color.FgWhite).SprintFunc()
88-
b.WriteString(white("🍕Please select an option:"))
89-
b.WriteString(white("\n Use arrow ↑↓ to navigate and press Enter to select.\n\n"))
85+
b.WriteString(color.WhiteString("🍕Please select an option:"))
86+
b.WriteString(color.WhiteString("\n Use arrow ↑↓ to navigate and press Enter to select.\n\n"))
9087

9188
for i, choice := range m.choices {
92-
cyan := color.New(color.FgCyan).SprintFunc()
93-
hiCyan := color.New(color.FgHiCyan).SprintFunc()
9489
if i == m.currentIdx {
95-
b.WriteString(fmt.Sprintf(hiCyan("➡️ %s\n"), choice))
90+
b.WriteString(fmt.Sprintf(color.HiCyanString("➡️ %s\n"), choice))
9691
} else {
97-
b.WriteString(fmt.Sprintf(cyan(" %s\n"), choice))
92+
b.WriteString(fmt.Sprintf(color.CyanString(" %s\n"), choice))
9893
}
9994
}
10095
return b.String()

internal/gateway/openai.go

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/sashabaranov/go-openai"
99
)
1010

11-
//go:generate mockgen -source=openai.go -destination=../../mock/openai.go
1211
type OpenAIGateway interface {
1312
GetAnswerFromPrompt(prompt string, variability float32) (string, error)
1413
AsyncGetAnswerFromPrompt(prompt string, variability float32) <-chan string

0 commit comments

Comments
 (0)