controller

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package controller ports bat's controller module: it drives the whole pipeline for each input — open and buffer it, detect the syntax (honoring language overrides, syntax mappings and ignored suffixes), highlight it, gather git changes, then walk the lines emitting headers, snip separators, highlighted content and footers through the printer. It also implements the undecorated "cat" path and binary-content handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType int

ContentType classifies buffered input, mirroring bat's content_inspector.

const (
	ContentEmpty ContentType = iota
	ContentBinary
	ContentUTF8
	ContentUTF16LE
	ContentUTF16BE
)

type Controller

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

Controller renders a set of inputs according to a Config.

func New

func New(cfg config.Config, stdin io.Reader) *Controller

New returns a Controller. stdin supplies standard input for KindStdin inputs.

func (*Controller) Run

func (c *Controller) Run(w io.Writer, inputs []input.Input) error

Run renders all inputs to w. It returns the first error encountered while still attempting to render remaining inputs (matching bat, which reports per-file errors but continues).

Jump to

Keyboard shortcuts

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