data

package
v1.223.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 8 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 MarkdownNoWrap added in v1.223.0

func MarkdownNoWrap(content string) error

MarkdownNoWrap renders markdown content without word-wrapping and writes to the data channel (stdout). Use this instead of Markdown for content with long inline tokens (URLs) that word-wrap can otherwise hard-break mid-token when they don't fit the wrap width. Falls back to Markdown if the registered renderer doesn't support no-wrap rendering.

func MarkdownNoWrapf added in v1.223.0

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

MarkdownNoWrapf renders formatted markdown content without word-wrapping and writes to the data channel (stdout). See MarkdownNoWrap.

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 Reset added in v1.203.0

func Reset()

Reset clears the global I/O context and markdown renderer. This is primarily used in tests to ensure clean state between test executions.

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 WriteUnmasked added in v1.223.0

func WriteUnmasked(content string) error

WriteUnmasked writes content to the data channel (stdout) WITHOUT secret masking.

Escape hatch for the narrow case where a user explicitly requested unmasked output containing their own resolved credentials for consumption by another program (e.g. `atmos auth env` emitting `export AWS_SECRET_ACCESS_KEY='...'` for `eval $(...)`). Routing that through Write() would mask the exact values the user asked for, silently breaking the feature.

Still resolves through the same dynamic stdout accessor as Write() (test output-capture via os.Stdout redirection keeps working) and still feeds --cast/session recording via io.RecordMaskedOutput — it only skips the masker.

Only use this when BOTH are true: (1) content is exactly what the user explicitly asked to receive unmasked, and (2) masking it would make the output unusable for its stated purpose (shell eval, etc). For everything else, use Write.

func WriteUnmaskedf added in v1.223.0

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

WriteUnmaskedf writes formatted content to the data channel (stdout) WITHOUT secret masking. See WriteUnmasked for when this is (and is not) appropriate to use.

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