aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <chaffinach+git@protonmail.ch>2022-04-03 17:17:24 +0100
committerMatthew Lemon <chaffinach+git@protonmail.ch>2022-04-03 17:17:24 +0100
commita95fe1f686e02bf5e7cfd9072ea973ded5cad734 (patch)
tree9f7cff8060a34048e8df647edcb0f25cc816749e
parent1f237d1ed24279b595489d02a37d4ef61a71cd8b (diff)
fixed issue in batnote based on bat not being present
Diffstat (limited to '')
-rwxr-xr-xbatnote17
1 files changed, 10 insertions, 7 deletions
diff --git a/batnote b/batnote
index d8db541..4bf52a5 100755
--- a/batnote
+++ b/batnote
@@ -12,9 +12,18 @@ VIM=/usr/bin/vim
CMD=$LESS
# instead of viewing with less, we want to edit in Vim
+if ! [[ -x $FZF_BIN ]]; then
+ echo "You need to have FZF installed for this to work."
+ exit 1
+fi
+
if [[ $1 = "-v" ]]
then
+ echo "Using vim..."
CMD=$VIM
+ # Thanks to https://stackoverflow.com/a/1489405 for the find command to omit .git
+ $CMD "$(find $NOTES -name '.git*' -type d -prune -o -type f -print|$FZF_BIN)"
+ exit
fi
# if [[ -z $1 ]]; then
@@ -24,16 +33,10 @@ fi
# TARGET=$1
# fi
-if ! [[ -x $FZF_BIN ]]; then
- echo "You need to have FZF installed for this to work."
- exit 1
-fi
if [[ -x $BAT ]]; then
CMD=$BAT
fi
+
# Thanks to https://stackoverflow.com/a/1489405 for the find command to omit .git
$CMD "$(find $NOTES -name '.git*' -type d -prune -o -type f -print|$FZF_BIN)"
-
-
-