1
1
#! /usr/bin/env bash
2
2
# -*- coding: UTF-8 -*-
3
- : ${ME:= $HOME / Me}
3
+ : " ${ME:= $HOME / Me} "
4
4
description=$@
5
5
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
+
6
19
if [ -z " $description " ]; then
7
20
command -v kdialog > /dev/null
8
21
if [ $? -eq 0 ]; then
@@ -15,26 +28,9 @@ if [ -z "$description" ]; then
15
28
if [ $? -eq 0 ]; then
16
29
description=` termux-dialog text -t " What are you thinking?" -i " I conquered the world today" | jq -r .text`
17
30
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
36
31
fi
37
32
33
+ # if description is still empty we must exit
38
34
if [ -z " $description " ]; then
39
35
echo " No description"
40
36
exit 0
@@ -64,7 +60,6 @@ if [ $rc -ne 0 ]; then
64
60
exit 1
65
61
fi
66
62
67
- echo " " >> " $noteFilename "
68
63
echo " " >> " $noteFilename "
69
64
echo ` LC_TIME=C date +" %H:%M" ` >> " $noteFilename "
70
65
echo $description >> " $noteFilename "
@@ -74,13 +69,12 @@ if [ $rc -ne 0 ]; then
74
69
exit 1
75
70
fi
76
71
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 )
80
74
set -x
81
- $ curr_dir /neovim-weekly-review.sh ` date +%W `
75
+ out= $( " $ curr_dir" /neovim-weekly-review.sh)
82
76
rc=$?
83
77
if [ $rc -ne 0 ]; then
84
- $WARNING " weekly review failed: $out "
78
+ $WARNING " weekly review failed: $out (error: $rc ) "
85
79
fi
86
80
fi
0 commit comments