out

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 1 module, 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 out provides the output formatting for the CLI

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableColor added in v0.3.10

func DisableColor()

DisableColor disables color output called if the ESCAPE_NO_COLOR environment variable is set

func GetShortDate added in v0.3.0

func GetShortDate(date string) string

GetShortDate returns the short date format of the given date

func InputSchema added in v1.0.0

func InputSchema(v any) bool

InputSchema prints the JSON Schema for the input type and returns true if input-schema was requested Commands that accept stdin input should call this to show their expected input format

func IsJSON

func IsJSON() bool

IsJSON reports whether stdout is reserved for a single JSON document.

func IsPretty

func IsPretty() bool

IsPretty reports whether stdout is the human table.

func IsSchemaMode added in v1.0.0

func IsSchemaMode() bool

IsSchemaMode returns true if the output mode is schema

func Link(value string) string

Link returns the standard clickable link label used in pretty output.

func LinkURL added in v1.4.0

func LinkURL(value string) string

LinkURL renders a hyperlink with the URL as visible text (for messages, not tables).

func Log

func Log(pretty string)

Log prints a human-readable status line. JSON mode keeps a single stdout document. When Print or Table already wrote that document, the line goes to stderr. When Log is the only output, it prints {"msg":"..."} so `command -o json | jq` still works.

func Print

func Print(data any, pretty string)

Print prints the data in the output format. In JSON mode this is the command's one stdout document.

func PrintError

func PrintError(err error)

PrintError writes the error chain to stderr. stdout stays the command document. A failed `scans watch -o json` prints one scan document there, then main exits 1 with this text on stderr.

func Schema added in v1.0.0

func Schema(v any) bool

Schema prints the JSON Schema for the given type and returns true if in schema mode Commands should call this at the start and return early if it returns true

func SetInputSchema added in v1.0.0

func SetInputSchema(v bool)

SetInputSchema sets the input schema flag

func SetOutput

func SetOutput(o string) error

SetOutput sets the output format for the CLI

func SetupTerminalLog

func SetupTerminalLog()

SetupTerminalLog sets up the terminal log

func StopTerminalLog

func StopTerminalLog()

StopTerminalLog stops the terminal log

func Table

func Table(data any, tableMaker func() []string)

Table prints a table of data

func TagText added in v0.3.8

func TagText(name string, hexRGB string) string

TagText is a helper function to colorize a tag name based on its hexRGB color

Types

type Message

type Message struct {
	Msg string `json:"msg"`
}

Message is the JSON payload for commands that only report success (for example `scans cancel`). They declare it as their output schema and Print it so structuredContent stays one validated document.

Jump to

Keyboard shortcuts

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