mkwr() { nvim "$HOME/docs/wr/$1" } mksec() { # Make an encrypted (secure entry). [ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return mkdir -p "/tmp/mksec" nvim "/tmp/mksec/$1" gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG" --output "$HOME/docs/wr/sec/$1" "/tmp/mksec/$1" rm "/tmp/mksec/$1" } rdsec() { # Read a secure entry, will NOT write it back after. [ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return mkdir -p "/tmp/mksec" gpg -d --output "/tmp/mksec/$1.decrypted" "$HOME/docs/wr/sec/$1" nvim "/tmp/mksec/$1.decrypted" rm "/tmp/mksec/$1.decrypted" } mdsec() { # Modify a secure entry, writing it back after. [ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return [ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return mkdir -p "/tmp/mksec" gpg -d --output "/tmp/mksec/$1.decrypted" "$HOME/docs/wr/sec/$1" nvim "/tmp/mksec/$1.decrypted" gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG" --output "$HOME/docs/wr/sec/$1" "/tmp/mksec/$1.decrypted" rm "/tmp/mksec/$1.decrypted" } mkrec() { mkwr "rec/$1" } mkkic() { mkwr "kic/$1" } mkdream() { # Dream Record: D~ if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi mkdir -p "$HOME/docs/wr/dream" nvim "$HOME/docs/wr/dream/D$(date --iso-8601 -d $DT).txt" } mn() { # Make note mkwr "mn/$1" } lle() { # Life Log Entry: L~ if [ -z $1 ] ; then DT="today" else DT="$1" fi mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)" nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/L$(date --iso-8601 -d $DT).txt" } holc () { # Holiday Entry: H~ if [ -z $1 ] ; then DT="today" else DT="$1" fi mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)" nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/H$(date --iso-8601 -d $DT).txt" } mer() { # Month End Recap: M~ if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)" nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/M$(date +%Y-%m -d $DT).txt" } yer() { # Year End Recap: Y~ if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi mkdir -p "$HOME/docs/wr/lle/$(date +%Y -d $DT)-12" nvim "$HOME/docs/wr/lle/$(date +%Y -d $DT)-12/Y$(date +%Y -d $DT).txt" }