initial commit

This commit is contained in:
Adam Goldsmith 2015-06-15 15:13:05 -04:00
commit 8b9cfd0456
11 changed files with 166 additions and 0 deletions

9
addp Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
[ "$1" = "usage" ] && echo ' addz "THING I NEED TO DO +project @context"' && echo " add an item with z priority" && exit 0
shift
pri="$1"
shift
"$TODO_FULL_SH" command add "($pri) $@"

6
addz Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
[ "$1" = "usage" ] && echo ' addz "THING I NEED TO DO +project @context"' && echo " add an item with z priority" && exit 0
shift
"$TODO_FULL_SH" command add '(Z) '"$@"

6
can Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " can" && echo " List things with no \"req:\"" && exit 0
shift
"$TODO_FULL_SH" |grep -v "req:"

6
et Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " et" && echo " Edit the todo.txt file with emacsclient -t" && exit 0
shift
emacsclient -t "$TODO_DIR/todo.txt"

74
hw Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
me="$(basename $0)"
textToDate ()
{
if [ ! "$(grep -P "(\d\d\.?){3}" <<< "$1")" ]
then
d=$(sed 's/^\(next\|n\)$/tomorrow/' <<< "$1")
date --date="$d" +"%Y-%m-%d" || exit 1
else
echo "$1";
fi
}
if [ "$1" = "usage" ]
then
echo " hw"
echo " list homework"
echo " hw add"
echo " prompt for adding an assignment"
echo " hw [due date] [class] [description]"
echo " add an assignment without a prompt"
echo " hw [date]"
echo " list assignments due on [date]"
echo " hw rel"
echo " list assignments with the dates in days relative to today"
exit 0
fi
shift
if [ "$1" = "add" ]
then
read -p "Due: " due
due="$(textToDate "$date")"
read -p "Class: " class
read -p "Description: " desc
"$TODO_FULL_SH" add "(B) +hw" "class:$class $due $desc"
elif [ "$1" = "rel" ]
then
"$TODO_FULL_SH" "$me" | sed -e "s/.*/echo \'&\'/g;s/due:\([0-9-]*\)/due:\'"'$(( ($(date --date="\1" +%s) - $(date --date="00:00" +%s)) \/ 86400 ))'"\'d/ge"
elif [ -n "$1" -a -n "$2" -a -n "$3" ]
then
due="due:$(textToDate "$1")" || { echo "invalid date" ; exit 1; }
shift
class="class:$1"
shift
"$TODO_FULL_SH" add "(B) +hw $due $class $@"
else
IFS=$'\n'
today=$(textToDate "today" | tr -d '-')
if [ -n "$1" ]
then
inDate="$(textToDate "$1" | tr -d '-' | cut -f1)"
fi
x=0
for i in $("$TODO_FULL_SH" list | grep "+hw")
do
x=$(($x+1))
date=$(grep -oP "due:\K[0-9-]*" <<< "$i"| tr -d '-' | cut -f1)
if [ "$date" -le "$today" ]
then
echo "$i" | sed "s/\(due:[0-9-]*\)/$(tput bold)\1$(tput sgr0)/g"
elif [ -n "$inDate" ]
then
if [ "$date" -eq "$inDate" ]
then
echo "$i"
fi
else
echo "$i"
fi
done
fi

29
lb Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " lb proj|con" && echo " List by project or context" && exit 0
shift
type=$1
first="true"
for i in $(todo.sh list$type)
do
#echo a newline before every $type, except the first
[ "$first" = "true" ] && first=0 || echo
#color the header
if [ "$type" = "proj" ]
then
#this is a very nasty hack
echo -ne $(echo -ne "$COLOR_PROJECT")
elif [ "$type" = "con" ]
then
#still a nasty hack
echo -ne $(echo -ne "$COLOR_CONTEXT")
fi
echo "$i:" #the actual header
tput sgr0 #clear color
"$TODO_FULL_SH" ls "$i" |
#remove todo.sh footer and indent lines
sed '/--/d;/TODO: [0-9]/d;s/^/ /g'
done

1
list Symbolic link
View File

@ -0,0 +1 @@
ls

7
ls Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " ls" && echo " ls, highlighting 'req:'s" && exit 0
shift
echo -e "$("$TODO_FULL_SH" command ls $@ |
sed "s/\(req:[^ $]*\)/$RED\1$DEFAULT/g")"

6
noz Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " noz" && echo " ls without (Z) priority" && exit 0
shift
"$TODO_FULL_SH" listpri -z "$1"

13
pantop Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
[ "$1" = "usage" ] && exit 0
shift
text="$("$TODO_FULL_SH" -p ls | head -n1)"
pri="PRI_$(sed -r 's/^[0-9]+ \(([A-Z])\).*/\1/' <<< "$text")"
text="${!pri}$text$DEFAULT"
text="$(sed -r 's` (\+[^ $]*)` '"$COLOR_PROJECT"'\1'"$DEFAULT"'`' <<< "$text")"
text="$(sed -r 's` (@[^ $]*)` '"$COLOR_CONTEXT"'\1'"$DEFAULT"'`' <<< "$text")"
echo '<txt>'"$text"'</txt>'

9
rz Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
[ "$1" = "usage" ] && echo " rz" && echo " get a random Z priority task" && exit 0
shift
number=$(( $RANDOM % ($("$TODO_FULL_SH" listpri Z "$1" | wc -l) -2) + 1 ))
#echo -n "$number "
"$TODO_FULL_SH" listpri Z "$1" | sed $number'q;d'