Sunday, December 10, 2006

XCode todo list

One of the things I use in TextMate regularly is the apple-cmd-b key combo, to bring up a todo list for the current project. Whenever I have something planned in my code, but don't feel like implementing it yet I annotate this piece of code with a comment like:

// TODO: check if url exists before saving it
saveURL(url);
The todo plugin will list all these TODO's from my code which gives me an indication on how to improve my code further.

The problem is that while I use TextMate for my web and java programming, I use XCode for most of the real programming done using Objective-C/Cocoa. But XCode doesn't have the todo feature and there is no way to add plugin's to XCode. Even a google search resulted in nothing on the subject.

So for now I'm using the Lightweight issue tracking bash script I found which seems like the only solution usable in combination with XCode.

# grep for "TODO" string
todo()
{
if [ $# -lt 1 ]; then
grep -R -n "TODO: " . | grep -v ".svn"
else
# loop through the args
while [ -n "$1" ]
do
grep -R -n "TODO: " "$1" | grep -v ".svn"
shift
done
fi
}


Add this script to your ~/.bash_profile to be able to execute the todo command that searches the current directory, or the directories given as argument for // TODO: lines.

No comments: