in reply to Tool for editing / viewing a TODO file.

A couple minor points.

$G{editor} = "emacs"; # editor to use $G{list_pager} = "less"; # output pager program
Both of these have existing unixy conventions. I would suggest a minor change:
$G{editor} = $ENV{EDITOR} || "vi"; # editor to use $G{list_pager} = $ENV{PAGER} || "more"; # output pager program
These follow unixy convention. That is, if EDITOR is not set, vi is supposed to be the fallback default for editor, while if PAGER is not set, more is supposed to be the fallback default for the pager. Since you probably should have these variables set to emacs and less, respectively, in your own environment for use with other programs anyway, this shouldn't actually affect your program's operation on your machine.

Further, you can completely get rid of the commandline options using a little shell trick:

$ PAGER="mail -S \"TODO reminders\" me@domain.com" t -l
or
$ EDITOR= t -e
to use vi. This trick just sets an environment variable (that is exported) but resets it back to what it was, after the command is finished, leaving it unchanged in the parent process.

With these minor changes, your program feels more part of the unix world, making it operate just like everything else. For example, if you have sudo set up, try "sudo -e /etc/inittab" - it will use your current EDITOR environment variable to launch an editor to modify the inittab. Or "crontab -e" - launches the same editor to modify your crontab entries. So why not "t -e"? :-)

To be honest, when I saw the CUFP on the Newest Nodes page, I thought there would be a "-a" (add) option and a "-r" option which would allow easy/fast ability to modify standard TODO files (such as one might find in module distributions). That would be really handy ;-)

Replies are listed 'Best First'.
Re^2: Tool for editing / viewing a TODO file.
by superfrink (Curate) on Jan 26, 2006 at 03:45 UTC
    when I saw the CUFP on the Newest Nodes page, I thought there would be a "-a" (add) option and a "-r" option which would allow easy/fast ability to modify standard TODO files

    That would be useful! I did not add those two arguments simply because my own TODO file has several sections (ASAP, Work, Projects, etc). I have emacs lisp to renumber the lines in a section. I would have to give the Perl script -section and -number arguments.

    It could all be done but for now this seems to work well enough. :)

    Update: Or "crontab -e" - launches the same editor to modify your crontab entries. So why not "t -e"?
    I am more likely to be adding an item or keeping the editor open in a window while I remove things from the list than I am to be viewing the it.