Skip to content

Commit ce2bf17

Browse files
javoireclaude
andauthored
fix: consistent spacing of check icons in sync output (#49)
* feat: add colorful terminal output Add colored output to improve CLI usability using fatih/color library: - Branch names in cyan - Current branch marker (*) in bold green - PR states: OPEN (green), MERGED (magenta), CLOSED (red) - Success/warning/error messages with colored icons - Tree structure pipes in dim gray - Progress indicators (1/5) in dim Includes --no-color flag and automatic NO_COLOR env var support. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: consistent spacing of check icons in sync output 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 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7ad4aa4 commit ce2bf17

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

cmd/sync.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,10 @@ func runSync(gitClient git.GitClient, githubClient github.GitHubClient) error {
609609

610610
// Rebase onto parent
611611
// If parent was just merged (oldParent set), use --onto to exclude old parent's commits
612-
if err := spinner.WrapWithSuccess(
613-
fmt.Sprintf(" Rebasing onto %s...", rebaseTarget),
614-
fmt.Sprintf(" Rebased onto %s", rebaseTarget),
612+
if err := spinner.WrapWithSuccessIndented(
613+
" ",
614+
fmt.Sprintf("Rebasing onto %s...", rebaseTarget),
615+
fmt.Sprintf("Rebased onto %s", rebaseTarget),
615616
func() error {
616617
if oldParent != "" {
617618
// Parent was merged - use --onto to handle squash merge
@@ -794,9 +795,10 @@ func runSync(gitClient git.GitClient, githubClient github.GitHubClient) error {
794795

795796
// Push to origin - only if the branch already exists remotely
796797
if branchExistsOnRemote {
797-
pushErr := spinner.WrapWithSuccess(
798-
" Pushing to origin...",
799-
" Pushed to origin",
798+
pushErr := spinner.WrapWithSuccessIndented(
799+
" ",
800+
"Pushing to origin...",
801+
"Pushed to origin",
800802
func() error {
801803
if syncForce {
802804
// Use regular --force (bypasses --force-with-lease safety checks)

internal/spinner/spinner.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,27 @@ func WrapWithSuccess(message, successMessage string, fn func() error) error {
156156
return nil
157157
}
158158

159+
// WrapWithSuccessIndented runs a function with a spinner and shows indented success/error message
160+
func WrapWithSuccessIndented(indent, message, successMessage string, fn func() error) error {
161+
if !Enabled {
162+
// When disabled (verbose mode), print message and run
163+
fmt.Println(indent + message)
164+
err := fn()
165+
if err != nil {
166+
fmt.Printf("%s%s Error: %v\n", indent, red.Sprint("✗"), err)
167+
}
168+
return err
169+
}
170+
sp := New(indent + message).Start()
171+
err := fn()
172+
if err != nil {
173+
sp.Stop(fmt.Sprintf("%s%s %s: %v", indent, red.Sprint("✗"), message, err))
174+
return err
175+
}
176+
sp.Stop(fmt.Sprintf("%s%s %s", indent, green.Sprint("✓"), successMessage))
177+
return nil
178+
}
179+
159180
// ProgressFunc is a function that can be called to update spinner progress
160181
type ProgressFunc func(message string)
161182

0 commit comments

Comments
 (0)