INNER CODE UNIT · Shell
post_filter
todotxt/todo.txt-cli · todo.sh:860
post_filter=${1:-}
shift
for search_term
do
## See if the first character of $search_term is a dash
if [ "${search_term:0:1}" != '-' ]
then
## First character isn't a dash: hide lines that don't match
## this $search_term
printf -v filter '%sgrep -i %q' "${filter:-}${filter:+ | }" "$search_term"
else
# First character is a dash: hide lines that match this
# $search_term
#
## Remove the first character (-) before adding to our filter command
printf -v filter '%sgrep -v -i %q' "${filter:-}${filter:+ | }" "${search_term:1}"
fi