Skip to content

Instantly share code, notes, and snippets.

@epochblue
Last active December 27, 2015 04:49
Show Gist options
  • Save epochblue/7269459 to your computer and use it in GitHub Desktop.
Save epochblue/7269459 to your computer and use it in GitHub Desktop.
A few add-ons for `todo.sh`: doneon: shows you items that were completed on a given date yesterday: shows you items that were completed yesterday edit: allows you to edit one of the todo.sh files without having to know its full path
#!/usr/bin/env bash
#
# Should be installed into $TODO_ACTIONS_DIR/doneon
# Note: be sure to make the script executable (chmod +x path/to/file)
#
action=$1
shift
function usage {
echo " $(basename $0)"
echo " Lists the items marked as done on the given date (YYYY-mm-dd)"
echo ""
exit
}
[ "$action" == "usage" ] && usage
date=$1
$TODO_SH lf "done.txt" $date
#!/usr/bin/env bash
#
# Should be installed into $TODO_ACTIONS_DIR/edit
# Note: be sure to make the script executable (chmod +x path/to/file)
#
action=$1
shift
function usage {
echo " $(basename $0)"
echo " Opens the given todo.sh file for editing in \$EDITOR"
echo ""
exit
}
[ "$action" == "usage" ] && usage
file=$1
found=0
for f in "$TODO_FILE" "$DONE_FILE" "$REPORT_FILE"; do
if [ $(basename $f) == "$file" ]; then
$EDITOR $f
found=1
fi
done
[ $found -eq 0 ] && echo "Unknown file: $file"
#!/usr/bin/env bash
#
# Should be installed into $TODO_ACTIONS_DIR/yesterday
# Note: be sure to make the script executable (chmod +x path/to/file)
#
action=$1
function usage {
echo " $(basename $0)"
echo " Lists the items marked as done yesterday."
echo ""
exit
}
[ "$action" == "usage" ] && usage
yesterday=$(date -r $((`date +%s` - 86400)) '+%Y-%m-%d')
$TODO_SH lf "done.txt" $yesterday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment