-
-
Save ear7h/bfa443faa491cdaf7fe256db1424c85b to your computer and use it in GitHub Desktop.
A command line todo application
This file contains 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
#!/usr/bin/env sh | |
alias isodate='date +"%Y-%m-%d"' | |
if [ $# -eq 0 ]; then | |
cat ~/todo/$(isodate).txt | |
exit 0 | |
fi | |
if [ $# -gt 1 ]; then | |
echo "invalid args" 1>&2 | |
echo "usage: todo carry|vim" 1>&2 | |
exit 1 | |
fi | |
case $1 in | |
"carry") | |
cat $(ls -r ~/todo/) | grep -v "[x]" >> ~/todo/$(isodate).txt | |
awk -i inplace '{ if (!seen[$0]++) print }' ~/todo/$(isodate).txt | |
cat ~/todo/$(isodate).txt | |
;; | |
"vim") | |
vim ~/todo/$(isodate).txt | |
;; | |
*) | |
echo "invalid args" 1>&2 | |
echo "usage: todo carry|vim" 1>&2 | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment