added scripts to list (ztl.sh) or search (zts.sh) tags
updated bash_aliases for new scripts
This commit is contained in:
parent
c5b1e4a592
commit
8a3dd477e1
|
@ -2,6 +2,14 @@
|
|||
# zn aliases
|
||||
alias zn="zn -p $HOME/.notes/notes"
|
||||
alias znt="zn -p $HOME/.notes/notes -t"
|
||||
alias zntl="ztl.sh $HOME/.notes/notes"
|
||||
alias znts="zts.sh $HOME/.notes/notes"
|
||||
alias zj="zn -p $HOME/.notes/journal"
|
||||
alias zjt="zn -p $HOME/.notes/journal -t"
|
||||
alias zjtl="ztl.sh $HOME/.notes/journal"
|
||||
alias zjts="zts.sh $HOME/.notes/journal"
|
||||
alias zw="zn -p $HOME/.notes/wfh-notes"
|
||||
alias zwt="zn -p $HOME/.notes/wfh-notes -t"
|
||||
alias zwtl="ztl.sh $HOME/.notes/wfh-notes"
|
||||
alias zwts="zts.sh $HOME/.notes/wfh-notes"
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
##############################################################################
|
||||
#
|
||||
# Simple script to generate tag list for zn
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Path to note dir expected as $1
|
||||
# Tag to search for expected as $2 - can be omitted to search all
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
rg --no-line-number --no-heading '^\#[a-zA-Z0-9]' ${1}/*.md | cut -d':' -f2 | sort | uniq -c
|
||||
else
|
||||
rg --no-line-number --no-heading --ignore-case "^#${2}" ${1}/*.md | cut -d':' -f2 | sort | uniq -c
|
||||
fi
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
##############################################################################
|
||||
#
|
||||
# Simple script to search zn notes for a specific tag
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Path to note dir expected as $1
|
||||
# Tag to search for expected as $2
|
||||
|
||||
list=$(rg --ignore-case --no-heading --no-line-number --files-with-matches "^#${2}" ${1}/*.md)
|
||||
|
||||
echo ""
|
||||
echo " Tags:"; echo " -----"
|
||||
rg --ignore-case --no-heading --no-line-number "^#${2}" ${1}/*.md | cut -d':' -f2 | sort | uniq -c
|
||||
echo ""
|
||||
|
||||
srch-res() {
|
||||
for i in $list
|
||||
do
|
||||
datetime=$(basename $i | sed 's/.md$//')
|
||||
title=$(head -1 $i | cut -d' ' -f2-)
|
||||
echo "(${datetime}): ${title}"
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
srch-res "" | sort -n
|
||||
|
Loading…
Reference in New Issue