Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadRef = errors.New("not a valid id or index")
ErrBadRef — argument is neither a valid id nor a resolvable index.
View Source
var ErrNoRecentSearch = errors.New("no recent search; provide a full 64-char id")
ErrNoRecentSearch — index used but no last-search.json exists.
Functions ¶
func ResolveRef ¶
ResolveRef turns a CLI argument into a snippet id.
- 64-char lowercase hex -> id itself
- non-negative integer < 1000 -> index into last-search hits
- anything else -> ErrBadRef
Types ¶
type LastSearch ¶
type LastSearch struct {
Query string `json:"query"`
Timestamp int64 `json:"timestamp"`
Hits []api.Hit `json:"hits"`
}
LastSearch is the persisted last-search.json document.
func Load ¶
func Load() (*LastSearch, error)
Load reads last-search.json. Returns ErrNoRecentSearch if absent.
Click to show internal directories.
Click to hide internal directories.