Skip to content

Commit ffe0c2e

Browse files
committed
quick note: fix default path for GUI and notification system
1 parent c1e390d commit ffe0c2e

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

neovim-quick-note.sh

+19-25
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
#!/usr/bin/env bash
22
# -*- coding: UTF-8 -*-
3-
: ${ME:=$HOME/Me}
3+
: "${ME:=$HOME/Me}"
44
description=$@
55

6+
# Default notification system is stdout
7+
WARNING="echo [!]"
8+
command -v notify-send > /dev/null
9+
if [ $? -eq 0 ]; then
10+
WARNING="notify-send --app-name QuickNote -i dialog-warning"
11+
fi
12+
13+
command -v termux-setup-storage > /dev/null
14+
if [ $? -eq 0 ]; then
15+
ME=$HOME/storage/documents/Me
16+
WARNING="termux-notification --content"
17+
fi
18+
619
if [ -z "$description" ]; then
720
command -v kdialog > /dev/null
821
if [ $? -eq 0 ]; then
@@ -15,26 +28,9 @@ if [ -z "$description" ]; then
1528
if [ $? -eq 0 ]; then
1629
description=`termux-dialog text -t "What are you thinking?" -i "I conquered the world today" | jq -r .text`
1730
fi
18-
19-
# Default notification system is stdout
20-
NOTIFY="echo"
21-
WARNING="echo [!]"
22-
23-
command -v notify-send > /dev/null
24-
if [ $? -eq 0 ]; then
25-
NOTIFY="notify-send --app-name QuickNote -i dialog-information"
26-
WARNING="notify-send --app-name QuickNote -i dialog-information"
27-
fi
28-
29-
30-
command -v termux-setup-storage > /dev/null
31-
if [ $? -eq 0 ]; then
32-
NOTIFY="termux-notification --content"
33-
WARNING="termux-notification --content"
34-
ME=$HOME/storage/documents/Me
35-
fi
3631
fi
3732

33+
# if description is still empty we must exit
3834
if [ -z "$description" ]; then
3935
echo "No description"
4036
exit 0
@@ -64,7 +60,6 @@ if [ $rc -ne 0 ]; then
6460
exit 1
6561
fi
6662

67-
echo "" >> "$noteFilename"
6863
echo "" >> "$noteFilename"
6964
echo `LC_TIME=C date +"%H:%M"` >> "$noteFilename"
7065
echo $description >> "$noteFilename"
@@ -74,13 +69,12 @@ if [ $rc -ne 0 ]; then
7469
exit 1
7570
fi
7671

77-
command -v termux-setup-storage > /dev/null
78-
if [ $? -eq 0 ]; then
79-
q curr_dir=$(dirname $0)
72+
if ! command -v termux-setup-storage > /dev/null; then
73+
curr_dir=$(dirname $0)
8074
set -x
81-
$curr_dir/neovim-weekly-review.sh `date +%W`
75+
out=$("$curr_dir"/neovim-weekly-review.sh)
8276
rc=$?
8377
if [ $rc -ne 0 ]; then
84-
$WARNING "weekly review failed: $out"
78+
$WARNING "weekly review failed: $out (error: $rc)"
8579
fi
8680
fi

0 commit comments

Comments
 (0)