Help us shape the future of Go! Take the 2026 Go Developer Survey

sync

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sync provides a TUI component for displaying sync progress.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteMsg

type CompleteMsg struct {
	Summary string
}

CompleteMsg indicates sync is complete

type DetailMark added in v0.19.2

type DetailMark int

DetailMark selects the status glyph shown on a detail row. Using a typed constant (rather than a bare bool) keeps the three states distinct at the call site and matches the streaming handler's markers.

const (
	// MarkDone shows a green ✓ for a completed item.
	MarkDone DetailMark = iota
	// MarkWarn shows an orange ⚠ for a skipped/attention item.
	MarkWarn
	// MarkInProgress shows a dim → for an item still in flight.
	MarkInProgress
)

type Model

type Model struct {
	core.BaseModel // Embedded for ReadySignaler interface
	CurrentPhase   Phase
	CurrentDetail  string // Current operation being performed
	TotalOps       int
	CompletedOps   int
	Progress       progress.Model

	Summary string
	// contains filtered or unexported fields
}

Model is the bubbletea model for sync progress. It embeds core.BaseModel for standard lifecycle handling. Uses tea.Printf to print completed items above the active UI.

func NewModel

func NewModel(totalOps int) *Model

NewModel creates a new sync model

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (*Model) View

func (m *Model) View() tea.View

View renders the model - shows only the active progress (package-manager pattern) Completed items are printed above via tea.Printf

type Phase

type Phase string

Phase represents a sync phase

const (
	PhaseTrunk    Phase = "trunk"
	PhaseBranches Phase = "branches"
	PhaseGitHub   Phase = "github"
	PhaseClean    Phase = "clean"
	PhaseRestack  Phase = "restack"
)

Phase constants

type PhaseCompleteMsg

type PhaseCompleteMsg struct {
	Phase Phase
}

PhaseCompleteMsg indicates a phase has completed

type PhaseDetailMsg

type PhaseDetailMsg struct {
	Phase   Phase
	Message string
	Mark    DetailMark // Status glyph for the row (defaults to MarkDone)
}

PhaseDetailMsg adds a detail line to a phase (printed above TUI)

type PhaseStartMsg

type PhaseStartMsg struct {
	Phase   Phase
	Message string // Phase header message (e.g., "📥 Pulling from remote...")
}

PhaseStartMsg indicates a phase has started

type ProgressTickMsg

type ProgressTickMsg struct {
	Completed int
	Total     int
}

ProgressTickMsg updates the progress bar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL