pecofy

package module
v0.0.0-...-28081dc Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 6 Imported by: 0

README

pecofy

Use peco to let users of the CLI tool select any string

Documentation

Overview

Use peco to let users of the CLI tool select any string

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *stringPecofy

func NewContainer

func NewContainer[T LineContainer]() *containerPecofy[T]

func NewContainerMock

func NewContainerMock[T LineContainer](indexes ...uint64) *containerPecofy[T]

func NewMock

func NewMock(indexes ...uint64) *stringPecofy

Types

type Input

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

func (*Input) AddLineContainers

func (i *Input) AddLineContainers(lines ...LineContainer) *Input

func (*Input) Get

func (i *Input) Get(index uint64) LineContainer

func (*Input) String

func (i *Input) String() string

type LineContainer

type LineContainer interface {
	String() string
	DisplayString() string
}

type Option

type Option []string

func (*Option) Prompt

func (o *Option) Prompt(prompt string) *Option

--prompt option for peco

func (*Option) Query

func (o *Option) Query(query string) *Option

--query option for peco

func (*Option) SelectOne

func (o *Option) SelectOne() *Option

--select-1 option for peco

func (*Option) SelectionPrefix

func (o *Option) SelectionPrefix(prefix string) *Option

--selection-prefix option for peco

type Peco

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

func (*Peco) Run

func (p *Peco) Run(ctx context.Context, option *Option, input *Input) ([]LineContainer, error)

Run implements Peco

type Runner

type Runner interface {
	Run(ctx context.Context, option *Option, input *Input) ([]LineContainer, error)
}

type StringLineContainer

type StringLineContainer string

func (StringLineContainer) DisplayString

func (s StringLineContainer) DisplayString() string

func (StringLineContainer) String

func (s StringLineContainer) String() string

Jump to

Keyboard shortcuts

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