output

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package output renders search results and docs to text/markdown/json.

Discipline: status messages always go to stderr; only the requested payload goes to stdout. ANSI styling is only applied when stdout is a real terminal AND NO_COLOR is unset — otherwise raw output flows through pipes cleanly (`c7search docs ... | glow -`, `| jq`, `> file.md`).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTTY

func IsTTY(f *os.File) bool

IsTTY reports whether the given file is connected to a terminal.

func RenderDoc

func RenderDoc(w io.Writer, doc client.Doc, f Format) error

RenderDoc writes a docs payload to w in the requested format.

func RenderLibraries

func RenderLibraries(w io.Writer, libs []client.Library, f Format, limit int) error

RenderLibraries writes a list of search hits to w in the requested format.

Types

type Format

type Format int

Format identifies which renderer to use.

const (
	FormatText Format = iota
	FormatMarkdown
	FormatJSON
)

func ParseFormat

func ParseFormat(s string) Format

ParseFormat maps a CLI flag value to a Format. Unknown → FormatText.

Jump to

Keyboard shortcuts

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