# README
🔍 go-fzf
Fuzzy Finder CLI and Library.
English | 日本語
目次
使い方
CLI として使用する
go-fzf で何ができるのかを知りたい場合は gofzf
CLI を試してください。
gofzf
CLI は go-fzf で作られており、 go-fzf のほとんどの機能を利用可能です。
詳しい情報はドキュメントをご参照ください。
ライブラリとして使用する
go-fzf を使用するとカスタマイズ性の高い Fuzzy Finder を簡単に作ることができます。
例えば、たったこれだけのコードで以下のような Fuzzy Finder を作ることができます。
package main
import (
"fmt"
"log"
"github.com/koki-develop/go-fzf"
)
func main() {
items := []string{"hello", "world", "foo", "bar"}
f, _ := fzf.New()
if err != nil {
log.Fatal(err)
}
idxs, err := f.Find(items, func(i int) string { return items[i] })
if err != nil {
log.Fatal(err)
}
for _, i := range idxs {
fmt.Println(items[i])
}
}
詳しい情報はドキュメントをご参照ください。
使用例
examples には go-fzf の使い方の様々な例が用意されています。
ライセンス
# Functions
New returns a new Fuzzy Finder.
NewStyles returns a new styles.
Search performs a fuzzy search for items.
WithCaseSensitive sets the case sensitivity.
WithCountView sets the function to create the count view.
WithCountViewEnabled enables or disables count view.
WithCursor sets the cursor.
WithHotReload sets the locker for read items.
WithInputPlaceholder sets the placeholder for input.
WithInputPosition sets the position of input.
WithItemPrefix sets the prefix function of the item.
WithKeyMap sets the key mapping.
WithLimit sets the number of items that can be selected.
WithNoLimit can be set to `true` to allow unlimited item selection.
WithPreselect sets the preselected indexes.
No description provided by the author
WithPreviewWindow sets the preview window function of the item.
WithPrompt sets the prompt text.
No description provided by the author
WithSelectedPrefix sets the prefix of the selected item.
WithStyleCursor sets the style of cursor.
WithStyleCursorLine sets the style of cursor line.
WithInputPlaceholder sets the style of placeholder for input.
WithStyleInputText sets the style of input text.
WithStyleMatches sets the style of the matched characters.
WithStylePrompt sets the style of prompt.
WithStyles sets the various styles.
WithStyleSelectedPrefix sets the style of prefix of the selected item.
WithStyleUnselectedPrefix sets the style of prefix of the unselected item.
WithUnselectedPrefix sets the prefix of the unselected item.
# Constants
No description provided by the author
No description provided by the author
# Variables
ErrAbort is returned when a Fuzzy Finder is aborted.
# Interfaces
Items represents a list of items to be searched.
# Type aliases
Option represents a option for the Find.
InputPosition represents the position of input.
Matches is a slice of Match.
Option represents a option for the Fuzzy Finder.
SearchOption represents a option for a search.
Option represents a option for the styles.