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:, lang:, owner:, size:, updated: and comments:.
Index ¶
Constants ¶
const ( FileKey = "file:" DescKey = "desc:" VisKey = "vis:" LangKey = "lang:" OwnerKey = "owner:" SizeKey = "size:" UpdatedKey = "updated:" CommentsKey = "comments:" )
The keys, with their colon.
Variables ¶
var Keys = []string{FileKey, DescKey, VisKey, LangKey, OwnerKey, SizeKey, UpdatedKey, CommentsKey}
Keys are the keys.
Functions ¶
func BoundHint ¶ added in v2.1.0
BoundHint says how to go on with word, a term with a bound being typed, or why it cannot be read; "" for any other word and one with nothing to add. What it shows is an example, not a value to fill in: a bound has none to offer.
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 Item ¶
type Item struct {
Description string
Files []string
Languages []string
Public bool
Owner string
// Size is the size of the files together, and Age how long ago it changed.
Size int64
Age time.Duration
Comments int
}
Item is what is looked in.
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, Owner part of the owner's
// login. Several of one key match any of them.
File, Desc, Vis, Lang, Owner []string
// Size are bounds on the size of a gist's files together and Updated on how
// long ago it changed, in nanoseconds, and Comments on how many comments it
// has. All of them must hold, so that two make a range.
Size, Updated, Comments []Bound
}
Query is the parsed filter, lower-cased.