re: The Power of the TODO List VIEW POST

FULL DISCUSSION
 

Neat idea. I've been using a single huge "todo.txt" but might try out this one-TODO-a-day.

Here's a script to automate the file creation:
$ echo ~/bin/newtodo

#!/bin/sh
TODO_DIR=~/todos/
TODO_PREFIX="TODO-"
mkdir -p $TODO_DIR
cd $TODO_DIR

# copy most recent* TODO file
# *recent = using filename, not last edited! So filenames need to be in a sane date format, like YYYY-MM-DD
RECENT_TODO=`ls -1 | head -n1`
# use this if you want to use last edited instead
# RECENT_TODO=`ls -1t | head -n1`

# %F == YYYY-MM-DD
TODO_SUFFIX=`date +"%F"`
TODO_FILENAME="${TODO_PREFIX}${TODO_SUFFIX}"

# if there is an existing TODO, then copy from that...
if [ -e "${RECENT_TODO}" ]; then
    cp ${RECENT_TODO} ${TODO_FILENAME}
else
    # ...otherwise, just create new TODO
    echo "TODO\n-do the thing\n\nAccomplished\n-created TODO\n" > ${TODO_FILENAME}
fi

echo "New todo created:\n${TODO_DIR}${TODO_FILENAME}"
code of conduct - report abuse