tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tui exposes the interactive terminal UI used by the vminfo CLI so it can be embedded in other Go programs.

Run starts the same full-screen, keyboard-driven dashboard the vminfo binary shows: live CPU, memory, network, and disk metrics, TCP and conntrack state, a process list, and host metadata. It requires a real TTY on the provided Options.Stdin and Options.Stdout; in a non-interactive context Run returns an error.

The UI language is selected via Options.Lang (for example "en" or "zh"); when empty it is auto-detected from the VMINFO_LANG, LC_ALL, and LANG environment variables.

Example:

err := tui.Run(ctx, tui.Options{Lang: "en"})
if err != nil {
    log.Fatal(err)
}

Host metric collection lives in the root package at github.com/cloudapp3/vminfo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts Options) error

Run starts the vminfo interactive terminal UI.

Types

type Options

type Options struct {
	// Stdout receives the rendered terminal UI. Defaults to os.Stdout.
	Stdout io.Writer
	// Stdin provides keyboard input. Defaults to os.Stdin.
	Stdin io.Reader
	// Lang selects the UI language. Examples: "en", "zh", "zh-CN".
	// Empty means auto-detect from VMINFO_LANG, LC_ALL, or LANG.
	Lang string
}

Options configures the interactive terminal UI.

Jump to

Keyboard shortcuts

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