From 4bde4c9fd06289df07324265b27e342389548f9c Mon Sep 17 00:00:00 2001 From: Braddux Date: Sat, 6 Aug 2011 19:55:36 -0700 Subject: [PATCH] Update to use TODOTXT_DEFAULT_ACTION --- Tips-and-Tricks.textile | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Tips-and-Tricks.textile b/Tips-and-Tricks.textile index 095e29e..ba4c7fd 100644 --- a/Tips-and-Tricks.textile +++ b/Tips-and-Tricks.textile @@ -12,23 +12,13 @@ alias t='todo.sh -d /path/to/your/todo.cfg' Then you simply type @t add laundry@ from anywhere in your file tree to add a task. -*Avoid typing todo.sh every time, a variation.* Add the following to your @~/.bashrc@ file (@~/.bash_profile@ for Mac and Cygwin users): +It is possible to set the default action be setting "TODOTXT_DEFAULT_ACTION". -
-function t() { 
-  if [ $# -eq 0 ]; then
-    todo.sh -d /path/to/your/todo.cfg ls
-  else
-    todo.sh -d /path/to/your/todo.cfg $* 
-  fi
-}
-
+You can combine the above alias with the default action so that typing @t@ lists your outstanding items. -Or using bash 3 or greater: -
function t() {
-  todo.sh -d /path/to/your/todo.cfg ${1:-"ls"} ${*#$1}
-}
-
+*Allow @t@ to list outstanding tasks* Add the following to your @~/.bashrc@ file (@~/.bash_profile@ for Mac and Cygwin users): +
export TODOTXT_DEFAULT_ACTION=ls
+alias t='todo.sh -d /path/to/your/todo.cfg'
You can still type @t add laundry@ from anywhere to add a task, but now you can just type @t@ to list your current tasks.