SYNOPSIS
cmd_cachier 'SUBCOMMAND' ['YOUR_COMMAND']…
cmd_cachier ['YOUR_COMMAND']…
PREREQUISITES
Redis must be installed via your package manager of choice and must be in your PATH variable. Check if you can run redis-server
from the command line.
$ brew install redis
DESCRIPTION
cmd_cachier
saves the stdout of your cli commands like find
or fd
.
If the command is not in the cache the command will execute in about the time it would take without cmd_cachier
.
The next time you use the command with cmd_cachier
the console output should feel instantanious.
Also the lifetime of the cache is only as long as the machine runs. Meaning after a reboot it is cleared.
To keep commands refreshed, you can manually execute your command with the save
subcommand,
or you could refresh it programmatically via systemd timers or crontab (see man crontab
).
crontab
example:
Run:
$ crontab -e
Add the line for an update every minute:
* * * * * cmd_cachier save YOUR_COMMAND
Or every 5 minutes:
*/5 * * * * cmd_cachier save YOUR_COMMAND
SUBCOMMANDS
The following subcommands are available:
save
[YOUR_COMMAND]…-
Save command to database in any case. Will overwrite if already in db.
memory
-
Display memory usage of saved commands.
EXAMPLES
Cache list of files in $HOME
:
$ cmd_cachier ls -1 "$HOME"
Cache list of git projects:
$ cmd_cachier fd --glob .git --hidden --type d --max-depth 6 --prune
Additionally, remove the .git
folders from the path:
$ cmd_cachier fd --glob .git --hidden --type d --max-depth 6 --prune | while read -r line; do tmp="${line%/}"; echo "${tmp%/*}"; done
With fzf
:
$ cmd_cachier fd . --type d --max-depth 5 --hidden "$HOME" | fzf
TIPS AND TRICKS
Alias gp
to cd
into a selected git project in the example above.
In your .bashrc
:
alias gp='cd "$(cmd_cachier YOUR_SEARCH_COMMAND | fzf)"'
Enforce refresh of the search on demand (alias with gpup
):
alias gpup='cd "$(cmd_cachier save YOUR_SEARCH_COMMAND | fzf)"'
KNOWN BUGS AND ISSUES
Status | Bug |
---|---|
Resolved in 0.3 |
Every now and then a |
Open |
Man page not availablein non-system installs and cargo installs. (Only help page.) |
Open (planned for 0.3.x or the next 0.4 release) |
Can only use the "redis-server" backend. Choosing "valkey" or "KeyDB" as backend is not supported yet. |
EXTERNAL LINKS
https://manpages.ubuntu.com/manpages/trusty/man7/groff_man.7.html