diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2017-03-07 16:04:06 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2017-03-07 16:04:06 +0100 |
| commit | d8bd493701fb8cf833380e0ab198778e6448b2e6 (patch) | |
| tree | d939a05049e71716aba030396b3dd873422c2101 | |
| download | diary-d8bd493701fb8cf833380e0ab198778e6448b2e6.tar.gz diary-d8bd493701fb8cf833380e0ab198778e6448b2e6.zip | |
initial commit
| -rw-r--r-- | Readme.md | 8 | ||||
| -rw-r--r-- | config.sample | 5 | ||||
| -rwxr-xr-x | diary | 53 |
3 files changed, 66 insertions, 0 deletions
diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..b86b836 --- /dev/null +++ b/Readme.md @@ -0,0 +1,8 @@ +# Diary - Personal diary + +## Configuration + +diary reads files at: + +1. $XDG_CONFIG/diary/config +2. $HOME/.diaryrc diff --git a/config.sample b/config.sample new file mode 100644 index 0000000..3b3e39e --- /dev/null +++ b/config.sample @@ -0,0 +1,5 @@ +# location of the diary +diary_location= + +# pgp key to encrypt entries +pgp_id= @@ -0,0 +1,53 @@ +#!/bin/bash + +# source config +if [ -n "$XDGCONFIG" ] +then + if [ -f $XDG_CONFIG/diary/config ] + then + source $XDG_CONFIG/diary/config + fi +elif [ -f $HOME/.config/diary/config ] +then + source $HOME/.config/diary/config +elif [ -f $HOME/.diaryrc ] +then + source $HOME/.diaryrc +else + echo "no configuration found" + return 1 +fi + +pushd $diary_location > /dev/null + +# Get the entry name +entry=$(date +%Y-%m-%d) +if [ ! -f ${entry}* ] +then + echo -e "Rating: " > $entry + new="true" +elif [ -f ${entry}*.gpg ] +then + entry=$(echo ${entry}* | cut -d "." -f 1 -) + gpg --output ${entry} -d ${entry}.gpg + rm ${entry}.gpg +fi + +eval $EDITOR $today* + +if [ -n "$new" ] +then + rating=$(head -1 $entry | cut -f 2 -d " " -) + mv $entry $entry,$rating + entry="$entry,$rating" +fi + +# Encrypt the entry +if [ -n "$pgp_id" ] +then + gpg -r "$pgp_id" -e ${entry} + rm ${entry} +fi + +popd > /dev/null + |
