Skip to content
This repository
Browse code

Minor formatting and comments changes

  • Loading branch information...
commit d6f00ca42ff178ea8a645eb24abb7d8ab147ef65 1 parent a03a3bf
David A. Harding harding authored

Showing 1 changed file with 15 additions and 16 deletions. Show diff stats Hide diff stats

  1. +15 16 todo.sh
31 todo.sh
@@ -353,11 +353,11 @@ _list() {
353 353 src="$TODO_DIR/$1"
354 354 elif [ -f "$FILE" ]
355 355 then
356   - ## Path relative to current working directory
357   - src="$FILE"
  356 + ## Path relative to current working directory
  357 + src="$FILE"
358 358 else
359 359 echo "TODO: File $FILE does not exist."
360   - exit 1
  360 + exit 1
361 361 fi
362 362
363 363 ## Get our search arguments, if any
@@ -373,11 +373,10 @@ _list() {
373 373 LINES=$( wc -l "$src" | sed 's/ .*//' )
374 374 PADDING=${#LINES}
375 375
376   - ## Search pattern or patterns specified; parse the file and then
377   - ## grep for each pattern afterwords.
378   -
  376 + ## Number, sort, and mangle the file, then run the filter command,
  377 + ## then mangle the file some more
379 378 command=$(
380   - sed = "$src" \
  379 + sed = "$src" \
381 380 | sed "N; s/^/ /; s/ *\(.\{$PADDING,\}\)\n/\1 /" \
382 381 | sed '''
383 382 s/^ /00000/;
@@ -386,7 +385,7 @@ _list() {
386 385 s/^ /00/;
387 386 s/^ /0/;
388 387 ''' \
389   - | sort -f -k2 \
  388 + | sort -f -k2 \
390 389 | sed '''
391 390 /^[0-9]\{'$PADDING'\} x /! {
392 391 s/\(.*(A).*\)/'$PRI_A'\1 '$DEFAULT'/g;
@@ -394,7 +393,7 @@ _list() {
394 393 s/\(.*(C).*\)/'$PRI_C'\1 '$DEFAULT'/g;
395 394 s/\(.*([D-Z]).*\)/'$PRI_X'\1 '$DEFAULT'/g;
396 395 }
397   - ''' \
  396 + ''' \
398 397 | eval ${filter_command:-cat} \
399 398 | sort -f -k2 \
400 399 | sed '''
@@ -617,14 +616,14 @@ case $action in
617 616
618 617 if [ "${1:-}" ]
619 618 then
620   - ## A priority was specified
621   - pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || {
622   - die "usage: $0 listpri PRIORITY
623   - note: PRIORITY must a single letter from A to Z."
624   - }
  619 + ## A priority was specified
  620 + pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || {
  621 + die "usage: $0 listpri PRIORITY
  622 + note: PRIORITY must a single letter from A to Z."
  623 + }
625 624 else
626   - ## No priority specified; show all priority tasks
627   - pri="[A-Z]"
  625 + ## No priority specified; show all priority tasks
  626 + pri="[A-Z]"
628 627 fi
629 628 pri="($pri)"
630 629 shift ## was priority

0 comments on commit d6f00ca

Please sign in to comment.
Something went wrong with that request. Please try again.