dotfiles/.local/bin/note

17 lines
566 B
Plaintext
Raw Normal View History

2020-09-04 10:16:46 +00:00
#!/bin/sh
p=$PWD
cd $HOME/daten/Dropbox/dokumente/notes
loc=$1
2020-09-04 10:16:46 +00:00
case $1 in
2020-10-07 19:54:05 +00:00
log|jrnl) shift; file=journal/${1:-jrnl}.txt;; #date +%F >>$file;;
idea) shift; file=ideas/${1:-README}.md;;
box) shift; file=box/$1.md;;
2020-09-04 10:16:46 +00:00
write) shift; file=writings/$1.md;;
msg) shift; file=archive/messages/$1.md;;
*) file=${1:-README}.md;;
esac
comment=$(test -f $file && echo Update || echo Create)
test "$2" && echo "$2" >>$file || $EDITOR + $file
git add $file && git commit -m "$(test "$(dirname $file)" != "." && echo "${loc%%/*}: ")$comment $(basename $file)" && git push
2020-09-04 10:16:46 +00:00
cd $p