tail

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTailLines = 10

DefaultTailLines is the default number of lines for tail

Variables

This section is empty.

Functions

func RunTail

func RunTail(w io.Writer, r io.Reader, args []string, opts TailOptions) error

RunTail executes the tail command r is the default input reader (used when args is empty or contains "-")

func Tail

func Tail(lines []string, n int) []string

Tail returns the last n lines from a slice (for compatibility)

Types

type TailOptions

type TailOptions struct {
	Lines   int           // -n: number of lines to print
	Bytes   int           // -c: number of bytes to print
	Follow  bool          // -f: output appended data as file grows
	Quiet   bool          // -q: never print headers
	Verbose bool          // -v: always print headers
	Sleep   time.Duration // --sleep-interval: sleep interval for -f
	JSON    bool          // --json: output as JSON
}

TailOptions configures the tail command behavior

type TailResult

type TailResult struct {
	File  string   `json:"file,omitempty"`
	Lines []string `json:"lines"`
}

TailResult represents tail output for JSON

Jump to

Keyboard shortcuts

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