progress

package
v0.0.0-...-3fbf090 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// This is only needed because pb.Pool require a real terminal.
	// It sets it into "raw-mode" but there is really no need for
	// this (see "func render()" below) so once this is fixed
	// upstream we should remove this.
	ESC         = "\x1b"
	ERASE_LINE  = ESC + "[2K"
	CURSOR_HIDE = ESC + "[?25l"
	CURSOR_SHOW = ESC + "[?25h"
)

Functions

func RunOSBuild

func RunOSBuild(pb ProgressBar, manifest []byte, exports []string, opts *OSBuildOptions) error

XXX: merge variant back into images/pkg/osbuild/osbuild-exec.go

Types

type OSBuildOptions

type OSBuildOptions struct {
	StoreDir  string
	OutputDir string
	ExtraEnv  []string
	InVm      []string

	// BuildLog writes the osbuild output to the given writer
	BuildLog io.Writer

	CacheMaxSize int64

	Metrics bool
}

type ProgressBar

type ProgressBar interface {
	// SetProgress sets the progress details at the given "level".
	// Levels should start with "0" and increase as the nesting
	// gets deeper.
	//
	// Note that reducing depth is currently not supported, once
	// a sub-progress is added it cannot be removed/hidden
	// (but if required it can be added, its a SMOP)
	SetProgress(level int, msg string, done int, total int) error

	// The high-level message that is displayed in a spinner
	// that contains the current top level step, for bib this
	// is really just "Manifest generation step" and
	// "Image generation step". We could map this to a three-level
	// progress as well but we spend 90% of the time in the
	// "Image generation step" so the UI looks a bit odd.
	SetPulseMsgf(fmt string, args ...interface{})

	// A high level message with the last operation status.
	// For us this usually comes from the stages and has information
	// like "Starting module org.osbuild.selinux"
	SetMessagef(fmt string, args ...interface{})

	// Start will start rendering the progress information
	Start()

	// Stop will stop rendering the progress information, the
	// screen is not cleared, the last few lines will be visible
	Stop()

	// Write implements io.Writer that is used to capture output
	// that is written after the progress bar is stopped via
	// Stop().
	Write(p []byte) (n int, err error)
}

ProgressBar is an interface for progress reporting when there is an arbitrary amount of sub-progress information (like osbuild)

func New

func New(typ string) (ProgressBar, error)

New creates a new progressbar based on the requested type

func NewDebugProgressBar

func NewDebugProgressBar() (ProgressBar, error)

NewDebugProgressBar will create a progressbar aimed to debug the lower level osbuild/images message. It will never clear the screen so "glitches/weird" messages from the lower-layers can be inspected easier.

func NewTerminalProgressBar

func NewTerminalProgressBar() (ProgressBar, error)

NewTerminalProgressBar creates a new default pb3 based progressbar suitable for most terminals.

func NewVerboseProgressBar

func NewVerboseProgressBar() (ProgressBar, error)

NewVerboseProgressBar starts a new "verbose" progressbar that will just prints message but does not show any progress.

Jump to

Keyboard shortcuts

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