[Remind-Fans] remind and todo lists

Neil Watson remind at watson-wilson.ca
Tue Nov 3 19:57:23 EST 2009


Greetings,

I've been experimenting with using Remind to manage my task lists.  I
created a wrapper script that allows me to categorize entries by context
and project.  I've attached it for anyone who is curious.  I'm curious
to see if others use Remind for tasks and todos and if so how.

Sincerely,
-- 
Neil Watson
Linux/UNIX Consultant
http://watson-wilson.ca
-------------- next part --------------
#!/bin/sh

# Limit path for good security practice
OLDPATH=$PATH
export PATH=/bin:/usr/bin

# Name me!
PROGRAM=rtd
VERSION=1.0

# Escape spaces from $HOME if there are any.  I must suffer this in Cygwin.
HOME=$(printf "$HOME"|sed -e 's/ /\\ /g')
# Default remind files
#FILES="$HOME/.reminders *.rem"
FILES="$HOME/todo.rem"

# Output man page to this default unless specified later.
mcmd=cat

usage(){
    cat 1>&2 <<EOF
    PROGRAM [ -p project -c context [-f file] remind commands ]
    Remind commands are any option that one might give to remind.

EOF
}

man() {
    cat <<EOF | $mcmd
.\" view by piping to nroff -c -man |col|less
.\"-----------------------------------------
.TH $PROGRAM 1 "Month Year" $VERSION
.\"-----------------------------------------
.SH NAME
$PROGRAM \(em Track remind calendar entries like a todo list.
.\"-----------------------------------------
.SH SYNOPSIS
.B $PROGRAM 
.B [ \-h | \-\^\-help ]
.B [ \-v | \-\^\-version ]
.B [ \-m | \-\^\-man ]
.B [ \-mm | \-\^\-mman ]
.B [ \-p | \-\^\-[!]project ]
.B [ \-c | \-\^\-[!]context ]
.B [ \-f | \-\^\-file ]
.B [ mmm day year ]
.B [ remind options ]
.\"-----------------------------------------
.SH DESCRIPTION
$PROGRAM augments the Roaring Penguin remind calendar program by allowing calendar entries to be classfied by context and project.  For example.

.IP "REM Sep 21 2009 +14 PRIORITY 20 MSG Design new widget PROJECT Xwidget CONTEXT work"
.IP "REM Sep 38 2009 +7  PRIORITY 10 MSG Olives, onions and gin CONTEXT groceries"

.P
The MSG section of the remind entry now has project and context keywords.  While remind sees no meaning in these words $PROGRAM will search from the an send only related entries to remind for processing.  The tasks will be sorted by date and priority.  See examples for more detail.
.\"-----------------------------------------
.SH OPTIONS
Options can be prefixed with either one or two hyphens, and
can be abbreviated to any unique prefix.  Thus,
.BR \-v ,
.BR \-ver ,
and
.B \-\^\-version
are equivalent.
.PP
.IP "[ \-h | \-\^\-help ]"
Print usage and exit.
.IP "[ \-v | \-\^\-version ]"
Print version number an exit.
.IP "[ \-m | \-\^\-man ]"
Print man page to stdout.
.IP "[ \-mm | \-\^\-mman ]"
Print raw man page to stdout.
.IP "[ \-p | \-\^\-[!]project ]"
List entries related to project or [!] not related to project.
.IP "[ \-c | \-\^\-[!]context ]"
List entries related to context or [!] not related to context.
.IP "[ \-f | \-\^\-file"
Search file or files instead of default (\$HOME/todo.rem).
.IP "[ mmm day year ]"
A date for remind to process (e.g sep 28 2009).  Today's date is the default.
.IP "[ remind options ]"
Options to pass to remind.  Options like *2 must be in quotes to prevent shell globbing.
.\"-----------------------------------------
.SH EXAMPLES
.IP "$PROGRAM -c groceries"
Show outstanding gorcery tasks.
.IP "$PROGRAM -p projectx sep 28 2009"
Show tasks for projectx due on September 28 2009.
.IP "$PROGRAM -p projectx '*2'"
Show tasks for projectx for the next two days.
.IP "$PROGRAM -c '!personal'"
Show today's tasks that are not personal in context.

.PP
Using certain remind date specs in the entries can achieve different goals.

.IP "REM Nov 6 2009 +14 MSG Milestone release PROEJECT mousetrap"
This task is due on Nov 6 but it will appear on the task list two weeks before hand in order to start working on it.
.IP "REM Nov 6 2009 *1 MSG Migrate data to new host PROJECT Cfengine"
This task is started on Nov 6 and will reappear every day until I finish and remove the *1.

.P
I typically mark tasks as done by changing the date to the when the task was finished and appending the MSG string with 'DONE'.
.\"-----------------------------------------
.SH "SEE ALSO"
.BR remind (1),
.\"-----------------------------------------
.SH AUTHOR
Neil H. Watson, www.watson-wilson.ca, neil-NOSPAM at watson-wilson.ca
.\"-----------------------------------------
.SH "LICENSE AND COPYING"
Copyright Year Neil H. Watson

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details
<http://www.gnu.org/licenses/>.
EOF
    exit
}

version(){
    printf "$PROGRAM version $VERSION"
}

error(){
# Errors are sent to stderr

    # This syslog action need only be used on hosts that have a running syslog
    #logger -s -t $PROGRAM "$@, $STATUS $ERROR"
    printf "Error: $@\n" 1>&2
    usage
    exit 1
}

# get opts
while test $# -gt 0
do
    case $1 in

        # For each option
        #-o)
        #shift
        #option="$1"
        #;;
        # Add custom options ABOVE the defaults below.

        --man | --ma | --m |\
        -man | -ma | -m )
        man=1
        # Read man command
        mcmd="eval nroff -c -man | col | less"
        ;;

        --mman | --mma | --mm |\
        -mman | -mma | -mm )
        mman=1
        ;;

        --version | --versio | --versi | --vers | --ver | --ve | --v |\
        -version | -versio | -versi | -vers | -ver | -ve | -v)
        version
        exit 0
        ;;

        --help | --hel | --he | --h | --\? |\
        -help | -hel | -he | -h | -\?)
        usage
        exit 0
        ;;

        --project | --projec | --proje | --proj | --pro | --pr | --p |\
        -project | -projec | -proje | -proj | -pro | -pr | -p )
        shift
        project=$1
        ;;

        --context | --contex | --conte | --cont | --con | --co | --c |\
        -context | -contex | -conte | -cont | -con | -co | -c )
        shift
        context=$1
        ;;

        --file | --fil | --fi | --f |\
        -file | -fil | -fi | -f )
        shift
        FILES=$1
        ;;

        #-*)
        #error "Unrecognized option: $1"
        #;;

        *)
        break
        ;;
    esac
    shift
done

# Left over arguments to go to remind.
rcmd="$@"

# Validate arguments 
if [ "0$man" -eq 1 ] && [ "0$mman" -eq 1 ]
then
    error "-m and --m are mutually exclusive"
elif [ "0$man" -eq 1 ] || [ "0$mman" -eq 1 ]
then
    man
fi

##########################
# Main matter begins.

grep_cmd="grep -ih"
grep_cmd2="grep -ih"

# Check for negation
if [ $(expr substr "${project}0" 1 1) = '!' ] 
then
    grep_cmd="$grep_cmd -v"
    project=$(printf $project|sed -e 's/^!//')
fi

if [ $(expr substr "${context}0" 1 1) = '!' ]
then
    grep_cmd2="$grep_cmd2 -v"
    context=$(printf $context|sed -e 's/^!//')
fi
pro_regex="project[[:space:]]\+$project" 
con_regex="context[[:space:]]\+$context" 

# If project and context required than print when both match (AND).
            if [[ ! -z $project ]] && [[ ! -z $context ]]
            then
                cmd="$grep_cmd -e \"$pro_regex\" $FILES | $grep_cmd2 -e \"$con_regex\""

# If project required then print matches.
            elif [[ ! -z $project ]]
            then
                cmd="$grep_cmd -e \"$pro_regex\" $FILES"

# If context required then print matches.
            elif [[ ! -z $context ]]
            then
                cmd="$grep_cmd2 -e \"$con_regex\" $FILES"
                 
# Default is to process everything
            elif [[ -z $project ]] && [[ -z $context ]]
            then
                cmd="$grep_cmd -e \".\" $FILES"

            fi


eval $cmd |remind -g - $rcmd

exit 0


More information about the Remind-fans mailing list