ui

package
v0.2.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: 15 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 ConfirmTarget added in v0.2.0

func ConfirmTarget(target, summary string) error

ConfirmTarget makes the user type the target's name before writing to a remote server.

func EditProfile added in v0.2.0

func EditProfile(drivers []driver.Driver, p *config.Profile, taken []string) error

EditProfile asks for a profile's name and its connection settings for every engine, prefilled with p. Leaving an engine's fields empty means the profile has no such engine.

func ManageProfiles added in v0.2.0

func ManageProfiles(store *config.Store, drivers []driver.Driver) error

ManageProfiles lets the user add, edit and delete profiles until they choose Done.

func Narrow

func Narrow(ctx context.Context, src driver.Endpoint, 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 Pick

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

Pick lets the user tick the databases to clone; existing marks the ones already on the target.

func PrintError added in v0.1.1

func PrintError(err error)

PrintError shows a failure inline, e.g. a source connection that does not work.

func PrintReport added in v0.1.1

func PrintReport(r preflight.Report)

PrintReport shows the local-setup checklist, with the fix under each failed line.

func SelectProfile added in v0.2.0

func SelectProfile(title string, names []string, def string) (string, error)

SelectProfile asks which profile to use, with def preselected.

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