From de9e70321e5c443ab44f6b3002693a25e36c9f52 Mon Sep 17 00:00:00 2001 From: Jonatan Dahl Date: Tue, 27 Jan 2026 15:36:30 -0500 Subject: [PATCH] fix: consistent spacing of check icons in sync output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add WrapWithSuccessIndented to spinner package for indented operations. Sub-operations (rebase, push) now show checkmarks at column 2 with consistent single-space after ✓. Co-Authored-By: Claude Opus 4.5 --- cmd/sync.go | 14 ++++++++------ internal/spinner/spinner.go | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/cmd/sync.go b/cmd/sync.go index 43eeb0a..f2ba742 100644 --- a/cmd/sync.go +++ b/cmd/sync.go @@ -609,9 +609,10 @@ func runSync(gitClient git.GitClient, githubClient github.GitHubClient) error { // Rebase onto parent // If parent was just merged (oldParent set), use --onto to exclude old parent's commits - if err := spinner.WrapWithSuccess( - fmt.Sprintf(" Rebasing onto %s...", rebaseTarget), - fmt.Sprintf(" Rebased onto %s", rebaseTarget), + if err := spinner.WrapWithSuccessIndented( + " ", + fmt.Sprintf("Rebasing onto %s...", rebaseTarget), + fmt.Sprintf("Rebased onto %s", rebaseTarget), func() error { if oldParent != "" { // Parent was merged - use --onto to handle squash merge @@ -794,9 +795,10 @@ func runSync(gitClient git.GitClient, githubClient github.GitHubClient) error { // Push to origin - only if the branch already exists remotely if branchExistsOnRemote { - pushErr := spinner.WrapWithSuccess( - " Pushing to origin...", - " Pushed to origin", + pushErr := spinner.WrapWithSuccessIndented( + " ", + "Pushing to origin...", + "Pushed to origin", func() error { if syncForce { // Use regular --force (bypasses --force-with-lease safety checks) diff --git a/internal/spinner/spinner.go b/internal/spinner/spinner.go index a695119..e1a7f51 100644 --- a/internal/spinner/spinner.go +++ b/internal/spinner/spinner.go @@ -156,6 +156,27 @@ func WrapWithSuccess(message, successMessage string, fn func() error) error { return nil } +// WrapWithSuccessIndented runs a function with a spinner and shows indented success/error message +func WrapWithSuccessIndented(indent, message, successMessage string, fn func() error) error { + if !Enabled { + // When disabled (verbose mode), print message and run + fmt.Println(indent + message) + err := fn() + if err != nil { + fmt.Printf("%s%s Error: %v\n", indent, red.Sprint("✗"), err) + } + return err + } + sp := New(indent + message).Start() + err := fn() + if err != nil { + sp.Stop(fmt.Sprintf("%s%s %s: %v", indent, red.Sprint("✗"), message, err)) + return err + } + sp.Stop(fmt.Sprintf("%s%s %s", indent, green.Sprint("✓"), successMessage)) + return nil +} + // ProgressFunc is a function that can be called to update spinner progress type ProgressFunc func(message string)