From eeb93fb4115a5a44f79734d86749aedf3ee62c4d Mon Sep 17 00:00:00 2001 From: Slug-Boi Date: Mon, 16 Jun 2025 17:31:09 +0200 Subject: [PATCH] refactor: change root command to use the new editor launcher --- src/cmd/root.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cmd/root.go b/src/cmd/root.go index 12b09f4..9d2f59f 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -9,8 +9,8 @@ import ( "github.com/Slug-Boi/cocommit/src/cmd/tui" "github.com/Slug-Boi/cocommit/src/cmd/utils" - "github.com/inancgumus/screen" "github.com/charmbracelet/lipgloss" + "github.com/inancgumus/screen" "github.com/spf13/cobra" ) @@ -155,7 +155,16 @@ func Execute() { func call_tui(args []string) []string { // 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 screen.Clear()