command

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

README

Documentation

Index

Constants

View Source
const (
	DiffUnified   diffUnifiedFlag = true
	DiffNoUnified diffUnifiedFlag = false
)

Variables

This section is empty.

Functions

func Diff

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

Diff compares two line streams position by position and emits their differences.

Output format:

  • default: ed-style — `< line` for an input1-only line, `> line` for an input2-only line, at each position where the lines differ.
  • DiffUnified (-u): a unified diff with `--- a` / `+++ b` headers, a single `@@ -1,N +1,M @@` hunk, and `-line` / `+line` / ` line` body rows.

Opts:

  • 1st positional file/Reader: input1 (overrides the upstream stream).
  • 2nd positional file/Reader: input2.
  • DiffInput: input2 as raw lines (highest precedence for input2).
  • DiffUnified: switch output format.
  • DiffFs: filesystem used to open File positionals (defaults to the OS).

Types

type DiffFs

type DiffFs struct{ afero.Fs }

DiffFs injects the filesystem used to open File positionals, so tests can supply an in-memory filesystem. The zero value falls back to the OS.

type DiffInput

type DiffInput [][]byte

DiffInput supplies the second input as raw lines, taking precedence over any second positional file path.

Directories

Path Synopsis
Package alias provides unprefixed type aliases for diff command flags.
Package alias provides unprefixed type aliases for diff command flags.

Jump to

Keyboard shortcuts

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