cmdgrouper

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Overview

Package cmdgrouper provides types for grouping together commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Start api.CmdID
	End   api.CmdID
	Name  string
}

Group is the product of a Grouper.

type Grouper

type Grouper interface {
	// Process considers the command for inclusion in the group.
	Process(context.Context, api.CmdID, api.Cmd, *api.State)
	// Build returns the groups built and resets the state of the grouper.
	Build(end api.CmdID) []Group
}

Grouper is the interface implemented by types that build groups.

func Marker

func Marker() Grouper

Marker returns a grouper that groups based on user marker commands.

func Run

func Run(pred RunPred) Grouper

Run returns a grouper that groups commands together that form a run.

type RunPred

type RunPred func(cmd api.Cmd, s *api.State) (value interface{}, name string)

RunPred is the predicate used by the Run grouper. Consecutive values returned by RunPred will be grouped together under the group with name.

Jump to

Keyboard shortcuts

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