filter

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultCustomFilterBufferThreshold = 100

DefaultCustomFilterBufferThreshold is the default value for BufferThreshold setting on CustomFilters.

Variables

View Source
var ErrFilterNotFound = errors.New("specified filter was not found")

Functions

This section is empty.

Types

type ExternalCmd

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

func NewExternalCmd

func NewExternalCmd(name string, cmd string, args []string, threshold int, idgen line.IDGenerator, enableSep bool) *ExternalCmd

NewExternalCmd creates a new filter that uses an external command to filter the input

func (*ExternalCmd) Apply

func (ecf *ExternalCmd) Apply(ctx context.Context, buf []line.Line, out pipeline.ChanOutput) (err error)

func (ExternalCmd) BufSize

func (ecf ExternalCmd) BufSize() int

func (*ExternalCmd) NewContext

func (ecf *ExternalCmd) NewContext(ctx context.Context, query string) context.Context

func (ExternalCmd) String

func (ecf ExternalCmd) String() string

type Filter

type Filter interface {
	Apply(context.Context, []line.Line, pipeline.ChanOutput) error
	BufSize() int
	NewContext(context.Context, string) context.Context
	String() string
}

type Fuzzy

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

func NewFuzzy

func NewFuzzy(sortLongest bool) *Fuzzy

NewFuzzy builds a fuzzy-finder type of filter. In effect, this uses a smart case filter, and for q query like "ABC" it matches the equivalent of "A(.*)B(.*)C(.*)".

With sortLongest = true, Fuzzy filter outputs the result sorted in the following precedence:

  1. Longer match
  2. Earlier match
  3. Shorter line length

func (*Fuzzy) Apply

func (ff *Fuzzy) Apply(ctx context.Context, lines []line.Line, out pipeline.ChanOutput) error

func (Fuzzy) BufSize

func (ff Fuzzy) BufSize() int

func (*Fuzzy) NewContext

func (ff *Fuzzy) NewContext(ctx context.Context, query string) context.Context

func (Fuzzy) String

func (ff Fuzzy) String() string

type Regexp

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

func NewCaseSensitive

func NewCaseSensitive() *Regexp

func NewIgnoreCase

func NewIgnoreCase() *Regexp

func NewRegexp

func NewRegexp() *Regexp

NewRegexp creates a new regexp based filter

func NewSmartCase

func NewSmartCase() *Regexp

SmartCase turns ON the ignore-case flag in the regexp if the query contains a upper-case character

func (*Regexp) Apply

func (rf *Regexp) Apply(ctx context.Context, lines []line.Line, out pipeline.ChanOutput) error

func (Regexp) BufSize

func (rf Regexp) BufSize() int

func (*Regexp) NewContext

func (rf *Regexp) NewContext(ctx context.Context, query string) context.Context

func (*Regexp) OutCh

func (rf *Regexp) OutCh() <-chan interface{}

func (Regexp) String

func (rf Regexp) String() string

type Set

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

func (*Set) Add

func (fs *Set) Add(lf Filter) error

func (*Set) Current

func (fs *Set) Current() Filter

func (*Set) Index

func (fs *Set) Index() int

func (*Set) Reset

func (fs *Set) Reset()

func (*Set) Rotate

func (fs *Set) Rotate()

func (*Set) SetCurrentByName

func (fs *Set) SetCurrentByName(name string) error

func (*Set) Size

func (fs *Set) Size() int

Jump to

Keyboard shortcuts

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