Skip to content

Commit 6648637

Browse files
committed
fix(cmd): update cost calculation in init and root commands
- Add cost update in `runInit` and `runCommit` functions. - Remove redundant cost update in `runCommit` function. [Generated by Kommit]
1 parent a51efdb commit 6648637

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

β€Žcmd/init.goβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func runInit(cmd *cobra.Command, args []string) {
106106
}
107107
os.Exit(1)
108108
}
109+
utils.UpdateCost(float64(result.Cost))
109110

110111
// Write config
111112
config.Commit.Scopes = result.Message.Scopes

β€Žcmd/root.goβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func runCommit(cmd *cobra.Command, args []string) {
6666
s := ui.Spinner("🧐 Helping your code express its feelings to future developers...")
6767
s.Start()
6868
result, err := llm.GenerateCommitMessage(config, diff)
69+
utils.UpdateCost(float64(result.Cost))
6970
s.Stop()
7071
if err != nil {
7172
fmt.Println("😰 Commitment issues detected: Your code is experiencing emotional resistance!")
@@ -134,7 +135,6 @@ func runCommit(cmd *cobra.Command, args []string) {
134135
os.Exit(1)
135136
}
136137
fmt.Println("🧐 Successfully committed! Your relationship with the repo has deepened!")
137-
utils.UpdateCost(float64(result.Cost))
138138
case ui.CommitOptionEdit:
139139
fmt.Println("🧐 Starting your self-guided therapy session...")
140140

@@ -178,7 +178,6 @@ func runCommit(cmd *cobra.Command, args []string) {
178178
}
179179

180180
fmt.Println("πŸŽ“ Self-therapy complete! You've committed to your own path of growth.")
181-
utils.UpdateCost(float64(result.Cost))
182181
case ui.CommitOptionRerun:
183182
runCommit(cmd, args)
184183
case ui.CommitOptionExit:

0 commit comments

Comments
Β (0)