transform

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTextStats

func PrintTextStats(text string, w io.Writer)

PrintTextStats prints text statistics.

func PrintWordFrequency

func PrintWordFrequency(text string, w io.Writer)

PrintWordFrequency prints top 30 words by frequency.

func Run

func Run(opts ...Option) error

Run executes the text transformation.

func SortLines

func SortLines(text string, numeric, descending, ignoreCase bool, field int, w io.Writer)

SortLines sorts lines of text.

Types

type Config

type Config struct {
	Mode        string
	Pattern     string
	Replacement string
	Numeric     bool
	Descending  bool
	IgnoreCase  bool
	SortField   int
	Input       []byte
	Stdout      io.Writer
}

Config holds configuration for the transform command.

type Option

type Option func(*Config)

Option configures a Config.

func WithDescending

func WithDescending(descending bool) Option

func WithIgnoreCase

func WithIgnoreCase(ignoreCase bool) Option

func WithInput

func WithInput(data []byte) Option

func WithMode

func WithMode(mode string) Option

func WithNumeric

func WithNumeric(numeric bool) Option

func WithPattern

func WithPattern(pattern string) Option

func WithReplacement

func WithReplacement(repl string) Option

func WithSortField

func WithSortField(field int) Option

func WithStdout

func WithStdout(w io.Writer) Option

Jump to

Keyboard shortcuts

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