command

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 7 Imported by: 0

README

Documentation

Index

Constants

View Source
const (
	// ErrOpenFile is returned when a named tee destination cannot be opened.
	ErrOpenFile errs.Const = "tee: cannot open file"
	// ErrWrite is returned when writing a line to a destination fails.
	ErrWrite errs.Const = "tee: write failed"
)
View Source
const (
	// TeeAppend (-a) appends to each named file instead of truncating it.
	TeeAppend teeAppendFlag = true
	// TeeTruncate (default) truncates each named file before writing.
	TeeTruncate teeAppendFlag = false
)

Variables

This section is empty.

Functions

func Tee

func Tee(opts ...any) gloo.Command[[]byte, []byte]

Tee returns a Command that passes lines through unchanged while writing each line to every named file and io.Writer as a side effect — the Unix tee.

Opts are interpreted by type:

  • gloo.File: a path written to on the injected filesystem (truncated, or appended to with TeeAppend).
  • io.Writer: registered as an additional side-effect destination.
  • io.Reader (and not also a Writer): used as the data source, overriding the upstream input stream. This lets Tee(strings.NewReader("..."), file) act as a self-sourcing pipeline element in examples.
  • TeeAppend (-a): append to files instead of truncating them.
  • TeeFs: the filesystem File paths resolve against (defaults to OS).

Types

type TeeFs

type TeeFs struct{ afero.Fs }

TeeFs injects the filesystem tee writes named File arguments to. It defaults to the OS filesystem; tests supply afero.NewMemMapFs().

Directories

Path Synopsis
Package alias provides unprefixed names for the tee command surface.
Package alias provides unprefixed names for the tee command surface.

Jump to

Keyboard shortcuts

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