refactor: change root command to use the new editor launcher

This commit is contained in:
Slug-Boi
2025-06-16 17:31:09 +02:00
parent 1367d50fce
commit eeb93fb411
+11 -2
View File
@@ -9,8 +9,8 @@ import (
"github.com/Slug-Boi/cocommit/src/cmd/tui" "github.com/Slug-Boi/cocommit/src/cmd/tui"
"github.com/Slug-Boi/cocommit/src/cmd/utils" "github.com/Slug-Boi/cocommit/src/cmd/utils"
"github.com/inancgumus/screen"
"github.com/charmbracelet/lipgloss" "github.com/charmbracelet/lipgloss"
"github.com/inancgumus/screen"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -155,7 +155,16 @@ func Execute() {
func call_tui(args []string) []string { func call_tui(args []string) []string {
// append commit message to args // append commit message to args
args = append(args, tui.Entry_CM()) //args = append(args, tui.Entry_CM())
message, err := utils.LaunchEditor(utils.ConfigVar.Settings.Editor,"")
if err != nil {
panic(fmt.Sprintf("Error launching editor: %v", err))
}
if message == "" {
message = tui.Entry_CM()
}
args = append(args, message)
// clear the screen // clear the screen
screen.Clear() screen.Clear()