output

package
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package output provides tree-structured rendering for DAG execution status.

Index

Constants

View Source
const (
	TreeBranch     = "├─" // Branch with siblings below
	TreeLastBranch = "└─" // Last branch (no siblings below)
	TreePipe       = "│ " // Vertical continuation line
	TreeSpace      = "  " // Empty space (no vertical line needed)
)

Tree drawing characters using Unicode box-drawing characters.

View Source
const DefaultMaxOutputLines = 50

DefaultMaxOutputLines is the default number of lines to show for stdout/stderr. Only the last N lines are shown (tail) when output exceeds this limit.

View Source
const DefaultMaxWidth = 80

DefaultMaxWidth is the maximum line width before wrapping.

Variables

This section is empty.

Functions

func ReadLogFileTail

func ReadLogFileTail(path string, maxLines int) ([]string, int, error)

ReadLogFileTail reads the last N lines from a log file. It returns:

  • lines: the actual log lines (tail portion if truncated)
  • truncated: number of lines that were truncated from the beginning
  • err: any error encountered while reading

If maxLines is 0 or negative, all lines are returned. If the file doesn't exist or is empty, returns nil, 0, nil. Binary files are detected and return ["(binary data)"], 0, nil. Files larger than 10MB are skipped to prevent memory exhaustion.

func StatusText

func StatusText(status core.Status) string

StatusText returns human-readable status text for a DAG status.

Types

type Config

type Config struct {
	// ColorEnabled enables colored output using ANSI escape codes.
	// Should be auto-detected based on terminal capability.
	ColorEnabled bool

	// ShowStdout enables display of stdout content in the tree.
	ShowStdout bool

	// ShowStderr enables display of stderr content in the tree.
	ShowStderr bool

	// MaxOutputLines limits stdout/stderr to last N lines (tail).
	// Set to 0 for unlimited output.
	MaxOutputLines int

	// MaxWidth is the maximum line width before wrapping.
	// Set to 0 for no wrapping.
	MaxWidth int
}

Config holds configuration for tree rendering.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration with sensible defaults.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer renders DAG execution status as a tree structure.

func NewRenderer

func NewRenderer(config Config) *Renderer

NewRenderer creates a new tree renderer with the given configuration.

func (*Renderer) RenderDAGStatus

func (r *Renderer) RenderDAGStatus(dag *core.DAG, status *execution.DAGRunStatus) string

RenderDAGStatus renders the complete DAG status as a pipelight-style tree. The output format is:

● Running - 2024-01-15 16:52:58
dag: my_dag (6s 619ms)
├─step: build (4s)
│ ├─echo hello
│ │ ├─stdout: hello
│ │ └─stderr:
│ └─result: ✓
└─step: test (2s)
  └─npm test
    ├─stdout: All tests passed
    └─stderr:

Jump to

Keyboard shortcuts

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