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
34 changes: 16 additions & 18 deletions internal/tui/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ func RenderConfirmation(
sb.WriteString("\n\n")

// Summary
sb.WriteString(fmt.Sprintf(" Version: %s %s %s\n",
fmt.Fprintf(&sb, " Version: %s %s %s\n",
CurrentVersionStyle.Render(prevVersion),
IconArrow,
NewVersionStyle.Render(newVersion),
))
sb.WriteString(fmt.Sprintf(" Tag: %s\n", NewVersionStyle.Render(tagName)))
sb.WriteString(fmt.Sprintf(" Commits: %d\n", commitCount))
)
fmt.Fprintf(&sb, " Tag: %s\n", NewVersionStyle.Render(tagName))
fmt.Fprintf(&sb, " Commits: %d\n", commitCount)

if noPush {
sb.WriteString(fmt.Sprintf(" Push: %s\n", WarningStyle.Render("disabled (--no-push)")))
fmt.Fprintf(&sb, " Push: %s\n", WarningStyle.Render("disabled (--no-push)"))
} else {
sb.WriteString(fmt.Sprintf(" Remote: %s\n", remoteName))
fmt.Fprintf(&sb, " Remote: %s\n", remoteName)
}

if dryRun {
Expand All @@ -50,11 +50,11 @@ func RenderConfirmation(
cancelLabel := "No, cancel"

if selected == 0 {
sb.WriteString(fmt.Sprintf(" %s %s\n", IconSelected, SelectedStyle.Render(confirmLabel)))
sb.WriteString(fmt.Sprintf(" %s\n", UnselectedStyle.Render(cancelLabel)))
fmt.Fprintf(&sb, " %s %s\n", IconSelected, SelectedStyle.Render(confirmLabel))
fmt.Fprintf(&sb, " %s\n", UnselectedStyle.Render(cancelLabel))
} else {
sb.WriteString(fmt.Sprintf(" %s\n", UnselectedStyle.Render(confirmLabel)))
sb.WriteString(fmt.Sprintf(" %s %s\n", IconSelected, SelectedStyle.Render(cancelLabel)))
fmt.Fprintf(&sb, " %s\n", UnselectedStyle.Render(confirmLabel))
fmt.Fprintf(&sb, " %s %s\n", IconSelected, SelectedStyle.Render(cancelLabel))
}

return sb.String()
Expand All @@ -67,15 +67,13 @@ func RenderSuccess(result *ExecutionSummary) string {
sb.WriteString(SuccessStyle.Render(fmt.Sprintf("%s Success!", IconCheck)))
sb.WriteString("\n\n")

sb.WriteString(fmt.Sprintf(" Created tag: %s\n", NewVersionStyle.Render(result.TagName)))
sb.WriteString(
fmt.Sprintf(" Commit: %s\n", CommitHashStyle.Render(result.CommitHash[:7])),
)
fmt.Fprintf(&sb, " Created tag: %s\n", NewVersionStyle.Render(result.TagName))
fmt.Fprintf(&sb, " Commit: %s\n", CommitHashStyle.Render(result.CommitHash[:7]))

if result.Pushed {
sb.WriteString(fmt.Sprintf(" Pushed to: %s\n", result.Remote))
fmt.Fprintf(&sb, " Pushed to: %s\n", result.Remote)
} else {
sb.WriteString(fmt.Sprintf(" Push: %s\n", WarningStyle.Render("skipped")))
fmt.Fprintf(&sb, " Push: %s\n", WarningStyle.Render("skipped"))
}

// Display post-push hook warnings if any
Expand All @@ -84,7 +82,7 @@ func RenderSuccess(result *ExecutionSummary) string {
sb.WriteString(WarningStyle.Render(" Post-push hook warnings:"))
sb.WriteString("\n")
for _, warning := range result.PostPushWarnings {
sb.WriteString(fmt.Sprintf(" %s %s\n", IconCross, warning))
fmt.Fprintf(&sb, " %s %s\n", IconCross, warning)
}
}

Expand All @@ -100,7 +98,7 @@ func RenderError(err error) string {

sb.WriteString(ErrorStyle.Render(fmt.Sprintf("%s Error", IconCross)))
sb.WriteString("\n\n")
sb.WriteString(fmt.Sprintf(" %s\n", err.Error()))
fmt.Fprintf(&sb, " %s\n", err.Error())
sb.WriteString("\n")
sb.WriteString(HelpStyle.Render("Press any key to exit"))

Expand Down
12 changes: 8 additions & 4 deletions internal/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,9 @@ func (m Model) View() string {
func (m Model) renderVersionSelectView() string {
var sb strings.Builder

sb.WriteString(fmt.Sprintf("Current version: %s\n\n",
fmt.Fprintf(&sb, "Current version: %s\n\n",
CurrentVersionStyle.Render(m.currentVersion.StringWithPrefix(m.config.Prefix)),
))
)

// Dual-pane layout: commits pane (top) + version pane (bottom)

Expand Down Expand Up @@ -733,7 +733,7 @@ func (m Model) renderCustomInputView() string {

sb.WriteString(SubtitleStyle.Render("Enter custom version:"))
sb.WriteString("\n\n")
sb.WriteString(fmt.Sprintf(" %s%s\n", m.config.Prefix, m.customInput.View()))
fmt.Fprintf(&sb, " %s%s\n", m.config.Prefix, m.customInput.View())

if m.err != nil {
sb.WriteString("\n")
Expand Down Expand Up @@ -880,7 +880,11 @@ func (m *Model) startNextHook() tea.Cmd {
DryRun: m.config.DryRun,
}

// Create cancellable context for hook execution
// Call previous cancel before overwriting — hooks completing normally don't cancel their own context.
if m.hookCancelFunc != nil {
m.hookCancelFunc()
}

ctx, cancel := context.WithCancel(context.Background())
m.hookCancelFunc = cancel

Expand Down
Loading