toyinteractivefilteringtool

package module
v0.0.0-...-cdae821 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 7 Imported by: 0

README

toy-interactive-filtering-tool

A toy interactive filtering tool

This is a repository to learn how a command line interactive filtering tool works. I heavily referenced a great simplistic interactive filtering tool, peco.

The simplest this tool example

ps aux | go run cmd/qeco/qeco.go

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ctx

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

Ctx contains all the important data. while you can easily access data in this struct from anwyehre, only do so via channels

func NewCtx

func NewCtx() *Ctx

func (*Ctx) AddWaitGroup

func (c *Ctx) AddWaitGroup()

func (*Ctx) Buffer

func (c *Ctx) Buffer() []Match

func (*Ctx) DrawCh

func (c *Ctx) DrawCh() chan []Match

func (*Ctx) DrawMatches

func (c *Ctx) DrawMatches(m []Match)

func (*Ctx) ExecQuery

func (c *Ctx) ExecQuery(v string)

func (*Ctx) LoopCh

func (c *Ctx) LoopCh() chan struct{}

func (*Ctx) NewFilter

func (c *Ctx) NewFilter() *Filter

func (*Ctx) NewInput

func (c *Ctx) NewInput() *Input

func (*Ctx) NewView

func (c *Ctx) NewView() *View

func (*Ctx) PagingCh

func (c *Ctx) PagingCh() chan PagingRequest

func (*Ctx) QueryCh

func (c *Ctx) QueryCh() chan string

func (*Ctx) ReadBuffer

func (c *Ctx) ReadBuffer(input io.Reader)

func (*Ctx) Refresh

func (c *Ctx) Refresh()

func (*Ctx) ReleaseWaitGroup

func (c *Ctx) ReleaseWaitGroup()

func (*Ctx) Result

func (c *Ctx) Result() string

func (*Ctx) Terminate

func (c *Ctx) Terminate()

func (*Ctx) WaitDone

func (c *Ctx) WaitDone()

type Filter

type Filter struct {
	*Ctx
}

func (*Filter) Loop

func (f *Filter) Loop()

type Input

type Input struct {
	*Ctx
}

func (*Input) Loop

func (i *Input) Loop()

type Match

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

type PagingRequest

type PagingRequest int
const (
	ToNextLine PagingRequest = iota
	ToNextPage
	ToPrevLine
	ToPrevPage
)

type View

type View struct {
	*Ctx
}

func (*View) Loop

func (u *View) Loop()

Directories

Path Synopsis
cmd
qeco command

Jump to

Keyboard shortcuts

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