tash lets you stash content that you can
access later.
🤔 Motivation
Every now and then, I find myself accessing some piece of string content (a
curl request, a shell command, or literally anything else) several times over
a period of time. While modern clipboard managers help in recalling previously
copied data, they require some searching. I needed a command line tool that
would make saving and querying string content quick and easy. So, I wrote
tash.
Usage: tash <COMMAND>
Commands:
delete Delete one or more content items
empty Empty entire stash
ls List stashed content keys
get Get content from stash
push Stash content
help Print this message or the help of the given subcommand(s)
Basic Usage
# push content to tash from stdinecho -n "some content" | tash push key
cat << EOF | tash push key
Multi line
content goes
here.
EOF# push content to tash from a filetash push key -f path/to/file.txt
# push content from a flagtash push key -d "content goes here"# push content while preventing overwritestash push key -d "content goes here" -p
# push content to tash from system clipboardtash push key -c
# get content from tashtash get key
# get content from tash and copy to system clipboardtash get key -c
# get content from tash and only copy to system clipboardtash get key -c --no-output
# get content from tash and remove it from its storetash get key --pop
# list content saved to tashtash ls
# delete content itemstash delete key1 key2 key3
# empty tash's storetash empty
Fetch content using fzf
The process of fetching content can be made easier by making use of a fuzzy
finder like fzf.
#!/usr/bin/env bash
selected_key=$( tash ls |
fzf \
--reverse \
--preview 'tash get {}'\
--preview-window=right:70% \
--preview-border=vertical \
--border=none
)if[ -z "$selected_key"]; thenexit0fitash get "${selected_key}" -nc