colwriter

package
v2.2.0-preview1+incomp... Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2014 License: MIT, MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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