Permalink
Browse files

Adding prels action to prepend item to normal list command

  • Loading branch information...
1 parent 824084a commit 66c7f2b25b3a5a12a81cde41c8d937724dbd13a0 @the1ts committed Oct 29, 2011
Showing with 36 additions and 0 deletions.
  1. +36 −0 actions/lists/prels
View
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+# 2011 Paul Mansfield <paul.mansfield@mansteck.co.uk>
+# License: GPL, http://www.gnu.org/copyleft/gpl.html
+
+if [ $1 != "useage" ]; then
+ action=$1;shift
+fi
+
+useage() {
+ echo " $(basename $0)"
+ echo " Prepend something to list command"
+ echo " useage:"
+ echo " todo.sh prels prepend text"
+ echo ""
+}
+
+case $1 in
+ "useage")
+ useage
+ ;;
+
+ "-h")
+ useage
+ ;;
+
+ *)
+ # Read in new lines and prepend $1 to usual _list output if a todo item line
+ while read line ; do
+ if [ $(echo $line | grep -c "^--$\|[0-9].* of [0-9].* tasks shown" ) -eq 0 ] ; then
+ echo $line | sed "s/^/$1/"
+ else
+ echo $line
+ fi
+ done < <(_list "$TODO_FILE")
+ ;;
+esac

0 comments on commit 66c7f2b

Please sign in to comment.