Skip to content

Commit e4882fe

Browse files
author
{cocoide}
committed
update push cmd interface
1 parent f16c5c1 commit e4882fe

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cmd/push.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66
import (
77
"fmt"
88
"github.com/charmbracelet/bubbles/spinner"
9+
"github.com/charmbracelet/bubbles/textarea"
910
"github.com/charmbracelet/bubbles/textinput"
1011
tea "github.com/charmbracelet/bubbletea"
1112
"github.com/cocoide/commitify/internal/entity"
@@ -31,7 +32,7 @@ type pushModel struct {
3132

3233
type prInput struct {
3334
titleInput textinput.Model
34-
bodyInput textinput.Model
35+
bodyInput textarea.Model
3536
}
3637

3738
type PushCmdStep int
@@ -158,11 +159,11 @@ func (m *pushModel) View() string {
158159
case SelectBaseBranch:
159160
return m.buildSelectBaseBranchText()
160161
case ConfirmPR:
161-
return color.HiWhiteString("<生成されたPRの確認: TabKeyで編集, EnterでPush>") + fmt.Sprintf("\n\nTitle: %s\n\nBody: %s", m.pr.Title, m.pr.Body)
162+
return color.HiWhiteString("<生成されたPRの確認: TabKeyで編集, EnterでPush>") + fmt.Sprintf("\n\nTitle:\n%s\n\nBody:\n%s", m.pr.Title, m.pr.Body)
162163
case EditPRTitle:
163-
return color.HiWhiteString("<Titleの編集: Enterで確定>") + fmt.Sprintf("\n\nTitle: %s\n\nBody: %s", m.prInput.titleInput.View(), m.pr.Body)
164+
return color.HiWhiteString("<Titleの編集: Enterで確定>") + fmt.Sprintf("\n\nTitle:\n%s\n\nBody:\n%s", m.prInput.titleInput.View(), m.pr.Body)
164165
case EditPRBody:
165-
return color.HiWhiteString("<Bodyの編集: EnterでPush>") + fmt.Sprintf("\n\nTitle: %s\n\nBody: %s", m.pr.Title, m.prInput.bodyInput.View())
166+
return color.HiWhiteString("<Bodyの編集: EnterでPush>") + fmt.Sprintf("\n\nTitle:\n%s\n\nBody:\n%s", m.pr.Title, m.prInput.bodyInput.View())
166167
case SubmitPR:
167168
return fmt.Sprintf("**🎉PRの作成に成功**")
168169
}
@@ -196,7 +197,7 @@ func NewPushModel() *pushModel {
196197
loadMsg: "",
197198
prInput: &prInput{
198199
titleInput: textinput.New(),
199-
bodyInput: textinput.New(),
200+
bodyInput: textarea.New(),
200201
},
201202
}
202203
}
@@ -255,7 +256,8 @@ func (m *pushModel) focusInPRBody() {
255256
input.Focus()
256257
input.SetValue(m.pr.Body)
257258
input.CharLimit = 1000
258-
input.Width = 500
259+
input.SetWidth(100)
260+
input.SetHeight(len(m.pr.Body) / 100)
259261
m.prInput.bodyInput = input
260262
}
261263

0 commit comments

Comments
 (0)