cli

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli holds CLI-only output helpers — never imported by the SDK under pkg/gohai/, only by cmd/. Mirrors jot's theme system (same Theme struct, same role names) so all retr0h CLIs share one shape. Uses raw ANSI to avoid charmbracelet dependency conflicts.

Index

Constants

This section is empty.

Variables

View Source
var ThemeMaxheadroom = Theme{
	Name:      "maxheadroom",
	Mute:      ansiFaint,
	Accent:    rgb(180, 167, 214),
	OK:        rgb(80, 250, 123),
	Err:       rgb(255, 110, 199),
	Info:      rgb(0, 212, 255),
	BannerTop: ansiFaint,
	BannerBot: rgb(180, 167, 214),
}

ThemeMaxheadroom is gohai's default — pulled from the maxheadroom palette. The primary accent is a soft lavender (#b4a7d6) — cooler and more muted than the magenta used by jot/grind; supporting roles are drawn from the same palette. Truecolor (24-bit) so the install banner and `gohai --help` paint with the exact same hue.

Functions

func Accent

func Accent(
	w io.Writer,
	s string,
) string

Accent returns s rendered as the brand accent color.

func Banner(
	w io.Writer,
) string

Banner returns the GOHAI block-letter logo, themed via the active theme's BannerTop/BannerBot colors. Line-level coloring matches the install summary so curl|bash and `gohai --help` look the same.

func Err

func Err(
	w io.Writer,
	s string,
) string

Err returns s in the error color.

func Failure

func Failure(
	w io.Writer,
	msg string,
) string

Failure mirrors Success for error one-liners.

func Info

func Info(
	w io.Writer,
	s string,
) string

Info returns s in the cool-toned info/hint color.

func Mute

func Mute(
	w io.Writer,
	s string,
) string

Mute returns s rendered as secondary text per the active theme.

func OK

func OK(
	w io.Writer,
	s string,
) string

OK returns s in the success color.

func Print

func Print(
	w io.Writer,
	s string,
)

Print writes a line to w.

func Printf

func Printf(
	w io.Writer,
	format string,
	a ...any,
)

Printf writes a formatted string to w.

func Success

func Success(
	w io.Writer,
	msg string,
) string

Success renders a leading mark in the OK color followed by msg.

func WriteCollectorList

func WriteCollectorList(
	out io.Writer,
) error

WriteCollectorList writes the collector registry grouped by category.

func WriteFlat

func WriteFlat(
	out io.Writer,
	facts *gohai.Facts,
) error

WriteFlat writes facts as sorted dot-separated key=value pairs.

func WriteJSON

func WriteJSON(
	out io.Writer,
	facts *gohai.Facts,
	pretty bool,
) error

WriteJSON writes facts as JSON, optionally pretty-printed.

func WriteOCSF added in v1.1.0

func WriteOCSF(
	out io.Writer,
	facts *gohai.Facts,
	pretty bool,
) error

WriteOCSF converts facts to an OCSF inventory_info event and writes the JSON to out.

func WriteOutput

func WriteOutput(
	out io.Writer,
	facts *gohai.Facts,
	pretty, flat bool,
) error

WriteOutput writes facts to out in the requested format.

Types

type Theme

type Theme struct {
	Name      string
	Mute      string
	Accent    string
	OK        string
	Err       string
	Info      string
	BannerTop string
	BannerBot string
}

Theme is a six-role palette covering every place gohai's CLI surface emits styled text. Roles are stable across themes so a theme swap is a pure recolor — no callers change.

Jump to

Keyboard shortcuts

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