Created
September 7, 2016 13:19
-
-
Save iansmith/b603e16c2b409515423e8472c5c7c769 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# i have various enable scripts, ping me if you want to understand the strategy behind these | |
# this is a translation of the (wonderful) code Kyle W. wrote for zsh. This is the bash version. | |
# use "source .enable-journal" in a shell where you want to use these functions/aliases | |
export EDITOR="atom --wait" | |
alias lsj="ls ~/.journal" | |
alias cdj="cd ~/.journal" | |
function catj { | |
cat ~/.journal/$(date -v${1:--0}d '+%Y-%m-%d') | |
} | |
function editj { | |
$EDITOR ~/.journal/$(date -v${1:--0}d '+%Y-%m-%d') | |
} | |
function journal { | |
if [ $# -eq 0 ]; then | |
catj | |
return | |
fi | |
journaldate=$(date "+%Y-%m-%d") | |
journalpath=~/.journal/$journaldate | |
journaltime=$(date "+%H:%M") | |
if [[ ! -a $journalpath ]]; then | |
echo "#$journaldate" > $journalpath | |
fi | |
echo "$journaltime\t$*" >> $journalpath | |
catj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment