ui

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset  = "\033[0m"
	Bold   = "\033[1m"
	Dim    = "\033[2m"
	Red    = "\033[31m"
	Green  = "\033[32m"
	Yellow = "\033[33m"
	Blue   = "\033[34m"
	Cyan   = "\033[36m"
	White  = "\033[37m"
)

ANSI color codes

View Source
const ThreeStringPlaceHolder = "\n%s%s%s\n"

Variables

This section is empty.

Functions

func BoldText

func BoldText(s string) string

Bold wraps s in bold ansi.

func Bullet

func Bullet(style, msg string)

Bullet prints a status bullet.

style: "ok", "warn", "error", "skip", "none", "found", "dry"

func ColorText

func ColorText(code, s string) string

ColorText applies a color to text.

func Confirm

func Confirm(prompt string, autoYes bool) bool

Confirm prompts the user for yes/no confirmation. Returns true if the user confirms (y/Y/yes), false otherwise. If autoYes is true, it auto-confirms without prompting.

func ConfirmInteractive

func ConfirmInteractive(prompt, note string, autoYes bool) bool

ConfirmInteractive is Confirm for prompts that must never block when no human is present. Under autoYes it auto-confirms; on a real terminal it prompts; otherwise (CI, `da refresh`, redirected/piped stdin) it returns false without reading, so the caller's safe default applies. note, when non-interactive, is logged so the skip is visible.

func Create

func Create(msg string)

Create prints a created item.

func DimText

func DimText(s string) string

DimText wraps s in dim ansi.

func DryRun

func DryRun(msg string)

DryRun prints a dry run action.

func Error

func Error(msg string)

Error prints an error to stderr.

func Errorf

func Errorf(format string, args ...interface{})

Errorf prints a formatted error to stderr.

func Header(title string)

Header prints a section header line.

func Info

func Info(msg string)

Info prints an info message.

func InfoBox

func InfoBox(title string, lines ...string)

InfoBox prints an info box.

func PreviewSection

func PreviewSection(title string, items ...string)

PreviewSection prints a labeled list of preview items.

func Section

func Section(label string)

Section prints a subsection label.

func Skip

func Skip(msg string)

Skip prints a skipped item.

func StdinIsInteractive

func StdinIsInteractive() bool

StdinIsInteractive reports whether stdin is connected to a terminal. Callers use it to avoid blocking on an interactive prompt when running non-interactively (CI, `da refresh`, piped/redirected input), where they should fall back to a deterministic default instead.

func Step

func Step(msg string)

Step prints a numbered step.

func StepN

func StepN(n, total int, msg string)

StepN prints a numbered step with n/total prefix.

func Success

func Success(msg string)

Success prints a success message.

func SuccessBox

func SuccessBox(msg string, nextSteps ...string)

SuccessBox prints a success message with next steps.

func Warn

func Warn(msg string)

Warn prints a warning.

func WarnBox

func WarnBox(title string, lines ...string)

WarnBox prints a warning box.

Types

This section is empty.

Jump to

Keyboard shortcuts

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