2 # t -- simple notes manager
3 # Copyright (C) 2013-2019 Sergey Matveev <stargrave@stargrave.org>
4 # Invoke the script without any arguments to briefly print all notes.
5 # Otherwise you can specify the following ones:
6 # a -- add new note (either starts an editor if not arguments are specified,
7 # or save them inside the note silently)
9 # m N -- modify note N by starting an editor
10 # N -- print out note's N contents
16 find $NOTES_DIR -size 0 -delete
21 find $NOTES_DIR -maxdepth 1 -type f | sort | sed -n $(($1 + 1))p
27 for n in $(find $NOTES_DIR -maxdepth 1 -type f | sort); do
28 echo "[$cnt]" "$(sed 's/^\(.\{1,70\}\).*$/\1/;q' $n)" "($(sed -n '$=' $n))"
37 note=$NOTES_DIR/$(date '+%s')
38 [ $# -gt 0 ] && echo "$@" > $note || $EDITOR $note
44 $EDITOR $(get_note $2)