aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-09-08 01:01:10 +0000
committerJulio Capote <jcapote@gmail.com>2022-09-08 01:01:10 +0000
commitfa2a7121e3bded8fe58d96b21d18b9567505f50d (patch)
tree040e2f725fe7a0e9480f9c4ca1a356d4a9eb7cc1
parenta000700a697e8c9b119eede3f78433efd3de4e0a (diff)
downloadrecit-fa2a7121e3bded8fe58d96b21d18b9567505f50d.tar.gz
save the timestamp before $EDITOR is opened
-rwxr-xr-xlibexec/recit-add-entry15
1 files changed, 8 insertions, 7 deletions
diff --git a/libexec/recit-add-entry b/libexec/recit-add-entry
index dba9ef5..078000e 100755
--- a/libexec/recit-add-entry
+++ b/libexec/recit-add-entry
@@ -38,6 +38,14 @@ if [[ "$query_time" = "" ]]; then
query_time="now"
fi
+if [[ "$query_time" == "now" || "$query_time" == "today" ]]; then
+ fmt_date=$(date '+%Y-%m-%d %r')
+elif [[ "$query_time" == "tomorrow" ]]; then
+ fmt_date=$(perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d', localtime(time + 86400)), qq(\n);")
+else
+ fmt_date=$query_time
+fi
+
if [[ "$notes" = "" ]]; then
if [[ -z ${EDITOR+x} ]]; then
@@ -51,13 +59,6 @@ if [[ "$notes" = "" ]]; then
rm "$tmpfile"
fi
-if [[ "$query_time" == "now" || "$query_time" == "today" ]]; then
- fmt_date=$(date '+%Y-%m-%d %r')
-elif [[ "$query_time" == "tomorrow" ]]; then
- fmt_date=$(perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d', localtime(time + 86400)), qq(\n);")
-else
- fmt_date=$query_time
-fi
if [[ "$project" = "" ]]; then
recins --verbose -f Id -v "$uuid" -f Time -v "$fmt_date" -f Notes -v "$notes" -t Entry "${recfile}"