Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions internal/spinner/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down