Skip to content

Commit f7f4349

Browse files
committed
refactor: improve logging and UI message clarity
1 parent da18b01 commit f7f4349

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

cmds/fastcommit/cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log/slog"
77
"os"
88
"sort"
9-
9+
1010
tea "github.com/charmbracelet/bubbletea"
1111
"github.com/charmbracelet/x/term"
1212
"github.com/pubgo/dix"
@@ -49,6 +49,7 @@ func New(params Params) *Command {
4949
},
5050
Commands: params.Cmd,
5151
Action: func(ctx context.Context, command *cli.Command) error {
52+
defer recovery.Exit()
5253
var cfg = params.Cfg
5354
if utils.IsHelp() {
5455
return cli.ShowAppHelp(command)
@@ -103,7 +104,7 @@ func New(params Params) *Command {
103104
}
104105

105106
msg := resp.Choices[0].Message.Content
106-
fmt.Println(msg)
107+
slog.Info("openai response git message", "msg", msg)
107108
var p1 = tea.NewProgram(InitialTextInputModel(msg))
108109
mm := assert.Must1(p1.Run()).(model2)
109110
if mm.isExit() {
@@ -128,6 +129,5 @@ type Command struct {
128129

129130
func (c *Command) Run() {
130131
defer recovery.Exit()
131-
sort.Sort(cli.FlagsByName(c.cmd.Flags))
132132
assert.Exit(c.cmd.Run(utils.Context(), os.Args))
133133
}

cmds/fastcommit/ui.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ func (m model2) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
6161

6262
// View is called to draw the textinput step
6363
func (m model2) View() string {
64-
return fmt.Sprintf(
65-
"git message: %s\n",
66-
m.textInput.View(),
67-
)
64+
return fmt.Sprintf("git message: %s\nPlease update and type key enter\n", m.textInput.View())
6865
}
6966

7067
func (m model2) Value() string {

0 commit comments

Comments
 (0)