Minor formatting and comments changes
This commit is contained in:
31
todo.sh
31
todo.sh
@@ -353,11 +353,11 @@ _list() {
|
|||||||
src="$TODO_DIR/$1"
|
src="$TODO_DIR/$1"
|
||||||
elif [ -f "$FILE" ]
|
elif [ -f "$FILE" ]
|
||||||
then
|
then
|
||||||
## Path relative to current working directory
|
## Path relative to current working directory
|
||||||
src="$FILE"
|
src="$FILE"
|
||||||
else
|
else
|
||||||
echo "TODO: File $FILE does not exist."
|
echo "TODO: File $FILE does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Get our search arguments, if any
|
## Get our search arguments, if any
|
||||||
@@ -373,11 +373,10 @@ _list() {
|
|||||||
LINES=$( wc -l "$src" | sed 's/ .*//' )
|
LINES=$( wc -l "$src" | sed 's/ .*//' )
|
||||||
PADDING=${#LINES}
|
PADDING=${#LINES}
|
||||||
|
|
||||||
## Search pattern or patterns specified; parse the file and then
|
## Number, sort, and mangle the file, then run the filter command,
|
||||||
## grep for each pattern afterwords.
|
## then mangle the file some more
|
||||||
|
|
||||||
command=$(
|
command=$(
|
||||||
sed = "$src" \
|
sed = "$src" \
|
||||||
| sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \
|
| sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \
|
||||||
| sed '''
|
| sed '''
|
||||||
s/^ /00000/;
|
s/^ /00000/;
|
||||||
@@ -386,7 +385,7 @@ _list() {
|
|||||||
s/^ /00/;
|
s/^ /00/;
|
||||||
s/^ /0/;
|
s/^ /0/;
|
||||||
''' \
|
''' \
|
||||||
| sort -f -k2 \
|
| sort -f -k2 \
|
||||||
| sed '''
|
| sed '''
|
||||||
/^[0-9]\{'$PADDING'\} x /! {
|
/^[0-9]\{'$PADDING'\} x /! {
|
||||||
s/\(.*(A).*\)/'$PRI_A'\1 '$DEFAULT'/g;
|
s/\(.*(A).*\)/'$PRI_A'\1 '$DEFAULT'/g;
|
||||||
@@ -394,7 +393,7 @@ _list() {
|
|||||||
s/\(.*(C).*\)/'$PRI_C'\1 '$DEFAULT'/g;
|
s/\(.*(C).*\)/'$PRI_C'\1 '$DEFAULT'/g;
|
||||||
s/\(.*([D-Z]).*\)/'$PRI_X'\1 '$DEFAULT'/g;
|
s/\(.*([D-Z]).*\)/'$PRI_X'\1 '$DEFAULT'/g;
|
||||||
}
|
}
|
||||||
''' \
|
''' \
|
||||||
| eval ${filter_command:-cat} \
|
| eval ${filter_command:-cat} \
|
||||||
| sort -f -k2 \
|
| sort -f -k2 \
|
||||||
| sed '''
|
| sed '''
|
||||||
@@ -617,14 +616,14 @@ case $action in
|
|||||||
|
|
||||||
if [ "${1:-}" ]
|
if [ "${1:-}" ]
|
||||||
then
|
then
|
||||||
## A priority was specified
|
## A priority was specified
|
||||||
pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || {
|
pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || {
|
||||||
die "usage: $0 listpri PRIORITY
|
die "usage: $0 listpri PRIORITY
|
||||||
note: PRIORITY must a single letter from A to Z."
|
note: PRIORITY must a single letter from A to Z."
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
## No priority specified; show all priority tasks
|
## No priority specified; show all priority tasks
|
||||||
pri="[A-Z]"
|
pri="[A-Z]"
|
||||||
fi
|
fi
|
||||||
pri="($pri)"
|
pri="($pri)"
|
||||||
shift ## was priority
|
shift ## was priority
|
||||||
|
|||||||
Reference in New Issue
Block a user