@@ 52,8 52,13 @@ cmd_remove() {
}
cmd_list() {
- path=${1:-""}
- tree -C -l --noreport "$NOTES_DIR/$path" | tail -n +2 | sed -E 's/\.md(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .md at end of line, but keep colors
+ path=${1:-"."}
+ (
+ cd "$NOTES_DIR"
+ tree -C -l --noreport "$path" \
+ | tail -n +1 \
+ | sed -E -e 's/\.md(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .md at end of line, but keep colors
+ )
}
PROGRAM="${0##*/}"
@@ 85,7 90,7 @@ cmd_usage() {
case "$1" in
init) shift; cmd_init ;;
open) shift; cmd_open $@;;
- ls|list) shift; cmd_list ;;
+ ls|list) shift; cmd_list $@;;
mv|move) shift; cmd_move $@ ;;
rm|remove) shift; cmd_remove $@ ;;
git) shift; git_cmd "$@" ;;