Documentation ¶
Index ¶
- Constants
- func IsTty() bool
- func LocateRcfile() (string, error)
- func TtyReady() error
- func TtyTerm()
- type CaseSensitiveMatcher
- type Config
- type Ctx
- func (c *Ctx) AddMatcher(m Matcher)
- func (c *Ctx) AddWaitGroup(v int)
- func (c *Ctx) Buffer() []Match
- func (c *Ctx) DrawCh() chan []Match
- func (c *Ctx) DrawMatches(m []Match)
- func (c *Ctx) ExecQuery(v string)
- func (c *Ctx) Finish()
- func (c *Ctx) LoadCustomMatcher() bool
- func (c *Ctx) LoopCh() chan struct{}
- func (c *Ctx) Matcher() Matcher
- func (c *Ctx) NewFilter() *Filter
- func (c *Ctx) NewInput() *Input
- func (c *Ctx) NewView() *View
- func (c *Ctx) PagingCh() chan PagingRequest
- func (c *Ctx) QueryCh() chan string
- func (c *Ctx) ReadBuffer(input io.Reader) error
- func (c *Ctx) ReadConfig(file string) error
- func (c *Ctx) Refresh()
- func (c *Ctx) ReleaseWaitGroup()
- func (c *Ctx) Result() []Match
- func (c *Ctx) SetCurrentMatcher(n string) bool
- func (c *Ctx) SetQuery(q []rune)
- func (c *Ctx) SignalHandlerLoop(sigCh chan os.Signal)
- func (c *Ctx) Terminate()
- func (c *Ctx) WaitDone()
- type CustomMatcher
- type DidMatch
- type Filter
- type IgnoreCaseMatcher
- type Input
- type Keymap
- type KeymapHandler
- type KeymapStringKey
- type Match
- type MatchString
- type Matcher
- type NoMatch
- type PagingRequest
- type RegexpMatcher
- type Selection
- type Style
- type StyleSet
- type View
Constants ¶
View Source
const ( IgnoreCaseMatch = "IgnoreCase" CaseSensitiveMatch = "CaseSensitive" RegexpMatch = "Regexp" )
Variables ¶
This section is empty.
Functions ¶
func LocateRcfile ¶ added in v0.1.3
Types ¶
type CaseSensitiveMatcher ¶ added in v0.1.1
type CaseSensitiveMatcher struct {
*RegexpMatcher
}
func NewCaseSensitiveMatcher ¶ added in v0.1.2
func NewCaseSensitiveMatcher(enableSep bool) *CaseSensitiveMatcher
func (*CaseSensitiveMatcher) String ¶ added in v0.1.1
func (m *CaseSensitiveMatcher) String() string
type Config ¶
type Config struct { Keymap Keymap `json:"Keymap"` Matcher string `json:"Matcher"` Style StyleSet `json:"Style"` CustomMatcher map[string][]string }
func (*Config) ReadFilename ¶
type Ctx ¶
type Ctx struct { Matchers []Matcher CurrentMatcher int ExitStatus int // 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 (*Ctx) AddMatcher ¶ added in v0.1.2
func (*Ctx) AddWaitGroup ¶
func (*Ctx) DrawMatches ¶
func (*Ctx) LoadCustomMatcher ¶ added in v0.1.3
func (*Ctx) PagingCh ¶
func (c *Ctx) PagingCh() chan PagingRequest
func (*Ctx) ReadConfig ¶
func (*Ctx) ReleaseWaitGroup ¶
func (c *Ctx) ReleaseWaitGroup()
func (*Ctx) SetCurrentMatcher ¶ added in v0.1.2
func (*Ctx) SignalHandlerLoop ¶ added in v0.1.2
type CustomMatcher ¶ added in v0.1.3
type CustomMatcher struct {
// contains filtered or unexported fields
}
func NewCustomMatcher ¶ added in v0.1.3
func NewCustomMatcher(enableSep bool, name string, args []string) *CustomMatcher
func (*CustomMatcher) Match ¶ added in v0.1.3
func (m *CustomMatcher) Match(quit chan struct{}, q string, buffer []Match) []Match
func (*CustomMatcher) String ¶ added in v0.1.3
func (m *CustomMatcher) String() string
type DidMatch ¶ added in v0.1.3
type DidMatch struct { *MatchString // contains filtered or unexported fields }
DidMatch contains the actual match, and the indices to the matches in the line
type IgnoreCaseMatcher ¶ added in v0.1.1
type IgnoreCaseMatcher struct {
*RegexpMatcher
}
func NewIgnoreCaseMatcher ¶ added in v0.1.2
func NewIgnoreCaseMatcher(enableSep bool) *IgnoreCaseMatcher
func (*IgnoreCaseMatcher) String ¶ added in v0.1.1
func (m *IgnoreCaseMatcher) String() string
type Keymap ¶
type Keymap map[termbox.Key]KeymapHandler
func (Keymap) Handler ¶
func (km Keymap) Handler(ev termbox.Event) KeymapHandler
func (Keymap) UnmarshalJSON ¶
type KeymapHandler ¶
type KeymapHandler func(*Input, termbox.Event)
type KeymapStringKey ¶
type KeymapStringKey string
func (KeymapStringKey) ToKey ¶
func (ksk KeymapStringKey) ToKey() (k termbox.Key, err error)
type Match ¶
type Match interface { Buffer() string // Raw buffer, may contain null Line() string // Line to be displayed Output() string // Output string to be displayed after peco is done Indices() [][]int }
Match defines the interface for matches. Note that to make drawing easier, we have a DidMatch and NoMatch types instead of using []Match and []string.
type MatchString ¶ added in v0.1.5
type MatchString struct {
// contains filtered or unexported fields
}
func NewMatchString ¶ added in v0.1.5
func NewMatchString(v string, enableSep bool) *MatchString
func (MatchString) Buffer ¶ added in v0.1.5
func (m MatchString) Buffer() string
func (MatchString) Line ¶ added in v0.1.5
func (m MatchString) Line() string
func (MatchString) Output ¶ added in v0.1.5
func (m MatchString) Output() string
type Matcher ¶ added in v0.1.1
type Matcher interface { // Match takes in three parameters. // // The first chan is the channel where cancel requests are sent. // If you receive a request here, you should stop running your query. // // The second is the query. Do what you want with it // // The third is the buffer in which to match the query against. Match(chan struct{}, string, []Match) []Match String() string }
Matcher interface defines the API for things that want to match against the buffer
type NoMatch ¶ added in v0.1.3
type NoMatch struct {
*MatchString
}
NoMatch is actually an alias to a regular string. It implements the Match interface, but just returns the underlying string with no matches
func NewNoMatch ¶ added in v0.1.5
type PagingRequest ¶
type PagingRequest int
PagingRequest can be sent to move the selection cursor
const ( // ToNextLine moves the selection to the next line ToNextLine PagingRequest = iota // ToNextPage moves the selection to the next page ToNextPage // ToPrevLine moves the selection to the previous line ToPrevLine // ToPrevPage moves the selection to the previous page ToPrevPage )
type RegexpMatcher ¶ added in v0.1.2
type RegexpMatcher struct {
// contains filtered or unexported fields
}
func NewRegexpMatcher ¶ added in v0.1.2
func NewRegexpMatcher(enableSep bool) *RegexpMatcher
func (*RegexpMatcher) Match ¶ added in v0.1.2
func (m *RegexpMatcher) Match(quit chan struct{}, q string, buffer []Match) []Match
func (*RegexpMatcher) MatchAllRegexps ¶ added in v0.1.2
func (m *RegexpMatcher) MatchAllRegexps(regexps []*regexp.Regexp, line string) [][]int
func (*RegexpMatcher) QueryToRegexps ¶ added in v0.1.2
func (m *RegexpMatcher) QueryToRegexps(query string) ([]*regexp.Regexp, error)
func (*RegexpMatcher) String ¶ added in v0.1.2
func (m *RegexpMatcher) String() string
type Style ¶ added in v0.1.2
type Style struct {
// contains filtered or unexported fields
}
func (*Style) UnmarshalJSON ¶ added in v0.1.2
Source Files ¶
Click to show internal directories.
Click to hide internal directories.