colwriter

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2014 License: MIT, Apache-2.0 Imports: 3 Imported by: 0

README

Package colwriter provides a write filter that formats
input lines in multiple columns.

The package is a straightforward translation from
/src/cmd/draw/mc.c in Plan 9 from User Space.

Documentation

Overview

Package colwriter provides a write filter that formats input lines in multiple columns.

The package is a straightforward translation from /src/cmd/draw/mc.c in Plan 9 from User Space.

Index

Constants

View Source
const (
	// Print each input line ending in a colon ':' separately.
	BreakOnColon uint = 1 << iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

A Writer is a filter that arranges input lines in as many columns as will fit in its width. Tab '\t' chars in the input are translated to sequences of spaces ending at multiples of 4 positions.

If BreakOnColon is set, each input line ending in a colon ':' is written separately.

The Writer assumes that all Unicode code points have the same width; this may not be true in some fonts.

func NewWriter

func NewWriter(w io.Writer, width int, flag uint) *Writer

NewWriter allocates and initializes a new Writer writing to w. Parameter width controls the total number of characters on each line across all columns.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush should be called after the last call to Write to ensure that any data buffered in the Writer is written to output.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Write writes p to the writer w. The only errors returned are ones encountered while writing to the underlying output stream.

Jump to

Keyboard shortcuts

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