zsh/modules/todo/init
Alexander Gehrke (crater2150) 9e8334698c make the todo call in cd() a hook added conditionally.
This way no error is thrown, when the todo program is missing.
2013-03-22 13:57:30 +01:00

17 lines
231 B
Bash

#!/bin/zsh
if command -v todo >/dev/null; then
todo_count() {
if [ -n "$2" ]; then
file="--database $2"
else
file="-G"
fi
todo ${=file} -f +${1:-high} | wc -l
}
chpwd_hook todo
else
todo_count() {
echo -1
}
fi