]> Sergey Matveev's repositories - t.git/blobdiff - t
More human-readable date
[t.git] / t
diff --git a/t b/t
index 27feb635026e84d1e5e6eeee57019e21cf31c520..12df2a0a35e61e56eb89c87625b48bfd1703384a 100755 (executable)
--- a/t
+++ b/t
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 # t -- simple notes manager
-# Copyright (C) 2013-2018 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2013-2020 Sergey Matveev <stargrave@stargrave.org>
 # Invoke the script without any arguments to briefly print all notes.
 # Otherwise you can specify the following ones:
 # a   -- add new note (either starts an editor if not arguments are specified,
@@ -34,7 +34,7 @@ fi
 case "$1" in
 a)
     shift
-    note=$NOTES_DIR/$(date '+%s')
+    note=$NOTES_DIR/$(date "+%Y%m%d-%H%M%S")
     [ $# -gt 0 ] && echo "$@" > $note || $EDITOR $note
     ;;
 d)
@@ -44,7 +44,8 @@ m)
     $EDITOR $(get_note $2)
     ;;
 *)
-    cat $(get_note $1)
+    note=$(get_note $1)
+    [ -e "$note" ] && cat $note || exit 1
     ;;
 esac
 purge