Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cd ~/Dropbox/zettelkasten
query=$1
result=$(egrep -ohs '^Tags:.*$' -- * | egrep -ohs '#[A-Za-z0-9_\-]+' | egrep -hs "$query" | sort | uniq | sed -e 's/.*/{"title":"&","arg":"&"},/' -e '1s/^/{"items":[/' -e '$s/$/]}/')
if [ -n "$result" ]
then
echo $result
else
echo "{\"items\":[{\"title\":\"Create Tag: #$query\",\"arg\":\"#$query\"}]}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.