zn/ztl.sh

17 lines
558 B
Bash
Executable File

#!/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