data

package
v1.202.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitWriter

func InitWriter(ioCtx io.Context)

InitWriter initializes the global data writer with an I/O context. This should be called once at application startup (in root.go).

func Markdown

func Markdown(content string) error

Markdown renders markdown content and writes to the data channel (stdout). Use this for help text, documentation, and other pipeable formatted content. Flow: data.Markdown() → MarkdownRenderer.Markdown() → io.Write(DataStream) → masking → stdout.

func Markdownf

func Markdownf(format string, a ...interface{}) error

Markdownf renders formatted markdown content and writes to the data channel (stdout). Flow: data.Markdownf() → data.Markdown() → io.Write(DataStream) → masking → stdout.

func SetMarkdownRenderer

func SetMarkdownRenderer(renderer MarkdownRenderer)

SetMarkdownRenderer sets the markdown renderer for data.Markdown(). This should be called after ui.InitFormatter() in root.go.

func Write

func Write(content string) error

Write writes content to the data channel (stdout). Flow: data.Write() → io.Write(DataStream) → masking → stdout.

func WriteJSON

func WriteJSON(v interface{}) error

WriteJSON marshals v to JSON and writes to the data channel (stdout). Flow: data.WriteJSON() → io.Write(DataStream) → masking → stdout.

func WriteYAML

func WriteYAML(v interface{}) error

WriteYAML marshals v to YAML and writes to the data channel (stdout). Flow: data.WriteYAML() → io.Write(DataStream) → masking → stdout.

func Writef

func Writef(format string, a ...interface{}) error

Writef writes formatted content to the data channel (stdout). Flow: data.Writef() → io.Write(DataStream) → masking → stdout.

func Writeln

func Writeln(content string) error

Writeln writes content followed by a newline to the data channel (stdout). Flow: data.Writeln() → io.Write(DataStream) → masking → stdout.

Types

type MarkdownRenderer

type MarkdownRenderer interface {
	Markdown(content string) (string, error)
}

MarkdownRenderer is the interface for rendering markdown. This avoids circular dependency with pkg/ui.

Jump to

Keyboard shortcuts

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