ui

package
v0.0.0-...-94269ba Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(prompt string) (bool, error)

Confirm asks a yes/no question using the default prompter.

func DiffAdd

func DiffAdd(line string) string

DiffAdd formats an added line.

func DiffHeader

func DiffHeader(client, path string) string

DiffHeader prints a colored header for a client's diff section.

func DiffNoChanges

func DiffNoChanges() string

DiffNoChanges returns a "(no changes)" message.

func DiffRemove

func DiffRemove(line string) string

DiffRemove formats a removed line.

func HasSecretPathPrefix

func HasSecretPathPrefix(secretPaths []string, serverName string) bool

HasSecretPathPrefix returns true if any secret path starts with the given server name prefix.

func MaskMapSecrets

func MaskMapSecrets(m map[string]any, secretPaths []string) map[string]any

MaskMapSecrets returns a deep copy of m with values at secretPaths masked. secretPaths use dot-separated notation: "serverName.field.key".

func MaskSecret

func MaskSecret(_ string) string

MaskSecret masks a secret value for display with a fixed placeholder.

func ReadSecret

func ReadSecret(prompt string) (string, error)

ReadSecret prompts for a secret value using the default reader.

func RenderPlanResult

func RenderPlanResult(w io.Writer, v PlanView) bool

RenderPlanResult writes a single client's plan diff to w. Returns true if changes were found. secretPaths lists JSON paths (e.g. "server.env.KEY") whose values should be masked.

Types

type PlanView

type PlanView struct {
	DisplayName      string
	ConfigPath       string
	Errors           []error
	HasChanges       bool
	Added            []string
	Changed          []string
	Removed          []string
	Desired          map[string]any
	SecretPaths      []string
	OverridesApplied map[string][]string
	RemoveUnmanaged  bool
	ProfileName      string
}

PlanView bundles the data needed to render a single client's plan diff.

type Prompter

type Prompter struct {
	In  io.Reader
	Out io.Writer
}

Prompter handles interactive user prompts.

func DefaultPrompter

func DefaultPrompter() *Prompter

DefaultPrompter returns a prompter using stdin/stdout.

func (*Prompter) Confirm

func (p *Prompter) Confirm(prompt string) (bool, error)

Confirm asks a yes/no question and returns the answer.

type SecretReader

type SecretReader struct {
	In  io.Reader
	Out io.Writer
}

SecretReader handles reading secret values with hidden input.

func DefaultSecretReader

func DefaultSecretReader() *SecretReader

DefaultSecretReader returns a reader using stdin/stderr.

func (*SecretReader) Read

func (s *SecretReader) Read(prompt string) (string, error)

Read prompts for a secret value and returns it.

type StatusWriter

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

StatusWriter writes ephemeral status lines to a writer (typically stderr). On a TTY it overwrites the current line using \r + ANSI clear; otherwise it prints each status on its own line.

func NewStatusWriter

func NewStatusWriter(w io.Writer) *StatusWriter

NewStatusWriter creates a StatusWriter. If w is a TTY-backed *os.File, status lines are overwritten in place.

func NopStatusWriter

func NopStatusWriter() *StatusWriter

NopStatusWriter returns a StatusWriter that discards all output.

func (*StatusWriter) Clear

func (s *StatusWriter) Clear()

Clear removes the current status line (TTY only).

func (*StatusWriter) Status

func (s *StatusWriter) Status(format string, args ...any)

Status writes an ephemeral status message. On a TTY the previous status line is overwritten; on a pipe each message gets its own line.

type Table

type Table struct {
	Headers []string
	Rows    [][]string
}

Table renders tabular data with aligned columns.

func (*Table) Render

func (t *Table) Render() string

Render returns the table as a formatted string.

Jump to

Keyboard shortcuts

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