lwc

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CarriageReturn means \r
	CarriageReturn byte = 13
	// LineFeed means \n
	LineFeed byte = 10
	// Space really means space
	Space byte = 32
)

Variables

This section is empty.

Functions

func PollCounts

func PollCounts(name string, counts *[]uint64, interval time.Duration, done chan bool)

PollCounts periodically writes counts to stdout

func PrintCounts

func PrintCounts(counts *[]uint64, name string, cr bool, lf bool)

PrintCounts writes formatted counts to stdout

func ProcessFiles

func ProcessFiles(config *Config)

ProcessFiles processes files as required by the configuration

func Run

func Run(version string, date string)

Run runs lwc

func ScanCount

func ScanCount(scanner *bufio.Scanner, count *uint64, total *uint64)

ScanCount applies a scanner and adds one for every occurrence

func ScanMaxLength

func ScanMaxLength(scanner *bufio.Scanner, count *uint64, total *uint64)

ScanMaxLength applies a scanner and remembers max string length

Types

type Config

type Config struct {
	Lines         bool
	Words         bool
	Chars         bool
	Bytes         bool
	MaxLineLength bool
	Files0From    string
	Interval      time.Duration
	Help          bool
	Version       bool
	Files         []string
	// contains filtered or unexported fields
}

Config represents a configuration

func NewConfig added in v0.4.0

func NewConfig(args []string) *Config

NewConfig creates a new Config

func (*Config) FilesChan added in v0.4.0

func (c *Config) FilesChan() *chan string

FilesChan creates the channel sending the filenames in the configuration

func (*Config) PrintUsage

func (c *Config) PrintUsage()

PrintUsage prints usage

func (*Config) Processors added in v0.4.0

func (c *Config) Processors() []Processor

Processors creates the processors enabled by the configuration

type Processor

type Processor struct {
	Split bufio.SplitFunc
	Scan  ScanFunc
}

Processor represents a scanner and splitter for input

type ScanFunc

type ScanFunc func(*bufio.Scanner, *uint64, *uint64)

ScanFunc represents a function that applies a scanner and updates counts

Jump to

Keyboard shortcuts

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