diff --git a/md.sh b/md.sh index 1c9b326..4ef315c 100755 --- a/md.sh +++ b/md.sh @@ -1,7 +1,8 @@ #! /bin/bash set -e -GREPPRG=${GREPPRG:-grep} +# Used to set the base directory to query. Defaults to current directory +MARKDONE_BASE_DIR=${MARKDONE_BASE_DIR:-.} function list_notes { echo "Notes" @@ -10,7 +11,7 @@ function list_notes { if [ "$query" == "" ]; then query="." fi - grep -l "$query" -R . + grep -l "$query" -R "$MARKDONE_BASE_DIR" } function list_tasks { @@ -37,7 +38,7 @@ function list_tasks { ;; esac query=".*$query" - grep "^[[:blank:]]*[^[:blank:]-][[:blank:]]*[*]\?[[:blank:]]*\[[$inner_task]\?\]$query" -R . -h + grep "^[[:blank:]]*[^[:blank:]-][[:blank:]]*[*]\?[[:blank:]]*\[[$inner_task]\?\]$query" -R "$MARKDONE_BASE_DIR" -h } function echo_help {