Documentation ¶
Overview ¶
Package fzf implements fzf, a command-line fuzzy finder.
The MIT License (MIT)
Copyright (c) 2016 Junegunn Choi ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func CountItems(cs []*Chunk) int
- func Run(opts *Options)
- type ByOrder
- type ByRelevance
- type ByRelevanceTac
- type Case
- type Chunk
- type ChunkCache
- type ChunkList
- type Delimiter
- type History
- type Item
- type ItemBuilder
- type MatchRequest
- type Matcher
- type Merger
- type Offset
- type Options
- type Pattern
- type Range
- type Reader
- type Terminal
- type Token
Constants ¶
const ( EvtReadNew util.EventType = iota EvtReadFin EvtSearchNew EvtSearchProgress EvtSearchFin EvtHeader EvtClose )
fzf events
Variables ¶
var EmptyMerger = NewMerger([][]*Item{}, false, false)
Merger with no data
Functions ¶
Types ¶
type ByRelevance ¶
type ByRelevance []*Item
ByRelevance is for sorting Items
func (ByRelevance) Len ¶
func (a ByRelevance) Len() int
func (ByRelevance) Less ¶
func (a ByRelevance) Less(i, j int) bool
func (ByRelevance) Swap ¶
func (a ByRelevance) Swap(i, j int)
type ByRelevanceTac ¶
type ByRelevanceTac []*Item
ByRelevanceTac is for sorting Items
func (ByRelevanceTac) Len ¶
func (a ByRelevanceTac) Len() int
func (ByRelevanceTac) Less ¶
func (a ByRelevanceTac) Less(i, j int) bool
func (ByRelevanceTac) Swap ¶
func (a ByRelevanceTac) Swap(i, j int)
type Chunk ¶
type Chunk []*Item // >>> []Item
Chunk is a list of Item pointers whose size has the upper limit of chunkSize
type ChunkCache ¶
type ChunkCache struct {
// contains filtered or unexported fields
}
ChunkCache associates Chunk and query string to lists of items
type ChunkList ¶
type ChunkList struct {
// contains filtered or unexported fields
}
ChunkList is a list of Chunks
func NewChunkList ¶
func NewChunkList(trans ItemBuilder) *ChunkList
NewChunkList returns a new ChunkList
type Delimiter ¶
type Delimiter struct {
// contains filtered or unexported fields
}
Delimiter for tokenizing the input
type History ¶
type History struct {
// contains filtered or unexported fields
}
History struct represents input history
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents each input line
type ItemBuilder ¶
ItemBuilder is a closure type that builds Item object from a pointer to a string and an integer
type MatchRequest ¶
type MatchRequest struct {
// contains filtered or unexported fields
}
MatchRequest represents a search request
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is responsible for performing search
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
Merger holds a set of locally sorted lists of items and provides the view of a single, globally-sorted list
func PassMerger ¶
PassMerger returns a new Merger that simply returns the items in the original order
type Offset ¶
type Offset [3]int32
Offset holds three 32-bit integers denoting the offsets of a matched substring
type Options ¶
type Options struct { Fuzzy bool Extended bool Case Case Nth []Range WithNth []Range Delimiter Delimiter Sort int Tac bool Criteria []criterion Multi bool Ansi bool Mouse bool Theme *curses.ColorTheme Black bool Reverse bool Cycle bool Hscroll bool InlineInfo bool Prompt string Query string Select1 bool Exit0 bool Filter *string ToggleSort bool Expect map[int]string Keymap map[int]actionType Execmap map[int]string PrintQuery bool ReadZero bool Sync bool History *History Header []string HeaderLines int Margin [4]string Tabstop int Version bool }
Options stores the values of command-line options
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern represents search pattern
func BuildPattern ¶
func BuildPattern(fuzzy bool, extended bool, caseMode Case, forward bool, nth []Range, delimiter Delimiter, runes []rune) *Pattern
BuildPattern builds Pattern object from the given arguments
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range represents nth-expression
func ParseRange ¶
ParseRange parses nth-expression and returns the corresponding Range object
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads from command or standard input
func (*Reader) ReadSource ¶
func (r *Reader) ReadSource()
ReadSource reads data from the default command or from standard input
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal represents terminal input/output
func NewTerminal ¶
NewTerminal returns new Terminal object
func (*Terminal) UpdateCount ¶
UpdateCount updates the count information
func (*Terminal) UpdateHeader ¶
UpdateHeader updates the header
func (*Terminal) UpdateList ¶
UpdateList updates Merger to display the list
func (*Terminal) UpdateProgress ¶
UpdateProgress updates the search progress