fileinput

package
v0.0.0-...-04d11d1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileInput

func FileInput(options_ ...Options) iter.Seq2[string, FileInfo]

FileInput is similar to Python's fileinput.

Types

type FileInfo

type FileInfo struct {
	// Filename of the current input file.
	Filename string

	// Line number within the file. (0 based)
	Line int
}

FileInfo contains information about the current line.

type FileInputSeq

type FileInputSeq func(yield func(text, file string, line int) bool)

type Options

type Options struct {
	// If true, STDOUT will be redirected to the input file. For inline replacements.
	InlineReplace bool

	// Input files. Defaults to [os.Args].
	Files []string

	// Backup suffix. Defaults to ".bak".
	BackupSuffix string
}

Options is options for FileInput.

Jump to

Keyboard shortcuts

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