delim_io

package
v0.0.0-...-791c77c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyWithPrefixOnDelim

func CopyWithPrefixOnDelim(
	delim byte,
	prefix string,
	dst ui.Printer,
	src io.Reader,
	includeLineNo bool,
) (n int64, err error)

Copies each `delim` suffixed segment from src to dst, and for each segment, adds the passed in prefix string.

Useful for taking a Reader and adding a prefix for every line, like how `git` shows `remote: <line>` for all remote stderr output. TODO extract into an io.Writer-like object

func Make

func Make(
	delim byte,
	r io.Reader,
) (dr *reader)

func PutReader

func PutReader(dr *reader)

Types

type Reader

type Reader interface {
	io.Reader
	N() int64
	Segments() int64
	IsEOF() bool
	ResetWith(dr reader)
	Reset()
	ReadOneString() (str string, err error)
	ReadOneKeyValue(sep string) (key, val string, err error)
}

Not safe for parallel use

Jump to

Keyboard shortcuts

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