ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ui is the terminal front: prompts (huh) and the live progress board (mpb).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(title, description, yes, no string) (bool, error)

func Narrow

func Narrow(ctx context.Context, jobs []clone.Job) ([]clone.Job, error)

Narrow lets the user restrict some of the picked databases to specific tables or collections. Databases left unticked in the first step are cloned whole.

func Onboard

func Onboard(drivers []driver.Driver) error

Onboard asks for every driver's staging settings, prefilled from the environment, and writes the answers back into it. Leaving a driver's fields blank skips that engine.

func Pick

func Pick(available []clone.Job, local map[string]bool) ([]clone.Job, error)

Pick lets the user tick the databases to clone; local marks the ones that already exist.

Types

type Bar

type Bar struct {
	// contains filtered or unexported fields
}

Bar implements clone.Reporter.

func (*Bar) Active

func (r *Bar) Active(streams int)

func (*Bar) Add

func (r *Bar) Add(n int64)

Add advances the bar. The estimate is rough, so when the stream outgrows it the total is pushed ahead instead of letting the bar sit at 100% while data is still flowing.

func (*Bar) Done

func (r *Bar) Done()

func (*Bar) Fail

func (r *Bar) Fail()

func (*Bar) Stage

func (r *Bar) Stage(s string)

func (*Bar) Start

func (r *Bar) Start(estimate int64)

type Board

type Board struct {
	// contains filtered or unexported fields
}

Board renders one live line per job:

⠹ mongo:shop   orders ⇉4   [=====>------]  42%  1.2 GiB / ~2.9 GiB  18.4 MiB/s  01:07

func NewBoard

func NewBoard() *Board

func (*Board) Track

func (b *Board) Track(name string) *Bar

func (*Board) Wait

func (b *Board) Wait()

Wait blocks until every bar has finished rendering.

Jump to

Keyboard shortcuts

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