hb

A handbook for UNIX

commit 133fcaef9ccd6e4a42ea7671fecb7cba720dafe1
parent 2bef8960c6d2d56ce3818570331a8b7ed55ac357
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 30 Mar 2024 15:41:48 +0530

Add default value for NB_PATH
Ignore .git* in notes/ folder
1 file changed, 3 insertions(+), 1 deletion(-)
M
nb
|
4
+++-
diff --git a/nb b/nb
@@ -9,7 +9,7 @@ nb_fatal_error() {
 
 nb_browse() {
 	cd "${NB_PATH}"
-	file="$(find . -type f | ${FUZZER})"
+	file="$(find . -not -wholename "**/.git*" -type f | ${FUZZER})"
 	[ "${file}" != "" ] && ${EDITOR} "${file}"
 }
 

@@ -51,6 +51,8 @@ nb_usage() {
 test -z "${EDITOR}" && { export EDITOR=vi; }
 # TODO detect windows, type on windows invokes a different command
 which "${EDITOR}" >/dev/null 2>/dev/null || { export EDITOR=cat; }
+XDG_DATA_HOME="${XDG_DATA_HOME:=$HOME}"
+NB_PATH="${NB_PATH:=$XDG_DATA_HOME/notes}"
 
 test -d "${NB_PATH}" || { nb_fatal_error "NB_PATH is not a directory"; exit 1; }
 cd "${NB_PATH}" || nb_fatal_error "NB_PATH is not a directory"