Documentation
¶
Overview ¶
Package filter narrows the list of gists: words found in order in a gist's description or file names, and key:value terms that look in one thing only: file:, desc:, vis: and lang:.
Index ¶
Constants ¶
const ( FileKey = "file:" DescKey = "desc:" VisKey = "vis:" LangKey = "lang:" )
The keys, with their colon.
Variables ¶
Keys are the keys.
Functions ¶
func Fuzzy ¶
Fuzzy reports whether the runes of pattern appear in s in order, ignoring case, and scores the match: consecutive runes and runes at the start of a word (after / - _ . or a space) count more, gaps count against it. hits are the rune indexes in s that matched.
It takes the first place the whole pattern fits, then the latest start that still fits before that end, so "app" in "a/b/app" matches the word rather than the stray a, moved back to a word start if one has the first rune ("bdot" in "babarot/dotfiles" starts at the first b).
func KeyRest ¶
KeyRest is what is left to type of the key the last word of query starts, with its colon, once that word has two letters and fits one key only. A word of a description often starts like a key, so one letter is too little.
Types ¶
type Query ¶
type Query struct {
Words []string
// File and Desc are parts of a file name or the description, Vis is secret
// or public, Lang part of a file's language. Several of one key match any
// of them.
File, Desc, Vis, Lang []string
}
Query is the parsed filter, lower-cased.