tui

package
v0.0.0-...-f332f66 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunFiles

func RunFiles(client *ssh.Client, alias string) error

RunFiles launches the two-pane file manager for an open SSH client. Returns when the user quits (Esc/q/F10). Local CWD starts at the OS process cwd; remote CWD starts at the SFTP server's reported home directory.

func SetBuildInfo

func SetBuildInfo(version, commit string)

SetBuildInfo lets main hand the linker-injected build details to the TUI.

Types

type Action

type Action string

Action describes what the user wants to do with the picked alias.

const (
	ActionNone    Action = ""        // user quit without picking
	ActionConnect Action = "connect" // open an interactive shell
	ActionSFTP    Action = "sftp"    // open an SFTP REPL
	ActionFiles   Action = "files"   // open the 2-pane file manager
	ActionForward Action = "forward" // run a port forward (extra args carry -L/-R/-D <spec>)
	// ActionExec runs a command across one or more hosts. extraArgs is
	// {"--host", "a,b,c", "<cmd…>"} or {"--group", "g", "<cmd…>"},
	// optionally prefixed with "--diff".
	ActionExec Action = "exec"
	// ActionWatch re-runs a command on one host. extraArgs is {"<cmd…>"};
	// alias carries the host.
	ActionWatch Action = "watch"
	// ActionAudit runs the task-oriented audit workflow with automatic private
	// project state. extraArgs carries the canonical selector or a lookup.
	ActionAudit Action = "audit"
	// ActionAccess runs an access lifecycle or expert command. extraArgs starts
	// with the access subcommand and carries every option selected in the form.
	ActionAccess Action = "access"
	// ActionCloud runs a Cloud artifact/profile command. Offline preparation
	// stays local; login, status, and upload are explicit network operations.
	ActionCloud Action = "cloud"
	// ActionPlaybook runs an Ansible playbook. extraArgs is the playbook
	// name followed by a {--host a,b | --group g} selector and optional
	// {--check, --diff, --extra-vars V} flags.
	ActionPlaybook Action = "playbook"
)

func Run

func Run(cfg *config.Config, configPath string) (string, Action, []string, error)

Run launches the TUI. Returns (alias, action, extraArgs). If action is ActionNone the user quit without picking anything. extraArgs carries extra command-line args for actions that need them (e.g. ActionForward returns {"-L", "8080:remote:3306"}).

type DiffOp

type DiffOp struct {
	Kind byte
	A, B int
	Text string
}

DiffOp is one entry in the line-level edit script produced by lineDiff: Kind is ' ' (context / equal), '-' (only in A, the baseline) or '+' (only in B, the selected). A and B are 1-based line numbers in the respective input — 0 means "no corresponding line". Text is the line without its trailing newline.

type ExecChoice

type ExecChoice int

ExecChoice is what the user picked at the end of an exec viewer session.

const (
	ExecBackToUI ExecChoice = iota // user pressed q — return to host list
	ExecToShell                    // user pressed x — drop to the shell
)

func ShowDriftReport

func ShowDriftReport(title, cmd string, groups []exec.OutputGroup) ExecChoice

ShowDriftReport opens the two-level drift viewer.

Overview keys: Enter open diff · b set baseline · j/k move · q back to UI · x exit to shell. Detail keys: j/k scroll · g/G top/bottom · n/p next/prev group · w save the current diff to a timestamped file · q/Esc back to overview · x exit.

func ShowHostResults

func ShowHostResults(title string, results []exec.Result) ExecChoice

ShowHostResults shows per-host exec output: scrollable, filterable (all / ok / failed), with save-to-file and host-to-host jumps. Returns the user's exit choice.

Jump to

Keyboard shortcuts

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