Skip to content

A small cache for unique lines of text, used to speedup the 'time to select' of expensive fzf invocations

License

Notifications You must be signed in to change notification settings

seanbreckenridge/fzfcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fzfcache

A small cache for unique lines of text, used to speedup the load time of expensive fzf invocations

Given any shell command as positional arguments:

  • If that command has been run in the past (determined by hashing the command itself), immediately prints the cached value -- this means you can immediately select something with fzf
  • Prints any lines from that shell command to STDOUT, which haven't already been printed from the cachefile, removing any duplicates
  • Once the shell command exits, saves the output of the shell command to a file in ~/.cache/fzfcache/

This keeps a history of one command, so its possible that lines from the previous result are included in the current fzf buffer/cachefile. So, if exact results are very important every time this is run, this probably isn't for you.

As an example:

As some other examples of me using this:

Install

Using go install to put it on your $GOBIN:

go install github.com/seanbreckenridge/fzfcache@latest

usage: fzfcache [-h] <SHELL COMMAND...>

Caches the input from the shell command and/or prints the cached results
This is typically piped into fzf, to decrease the time till interactive

About

A small cache for unique lines of text, used to speedup the 'time to select' of expensive fzf invocations

Topics

Resources

License

Stars

Watchers

Forks