Add setting of base dir via env

This commit is contained in:
IamTheFij 2018-04-27 13:07:15 -07:00
parent 35971a5c37
commit d387133deb
1 changed files with 4 additions and 3 deletions

7
md.sh
View File

@ -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 {