Permalink
Browse files

Merge branch 'master' into cleanup

  • Loading branch information...
2 parents e6bf56f + 2afd2ad commit b4617b28f16d946cd709fa0417d680d776200dae @trajano committed Feb 14, 2011
Showing with 68 additions and 12 deletions.
  1. +10 −6 tests/t1000-addlist.sh
  2. +58 −6 todo.sh
View
@@ -58,19 +58,23 @@ TODO: 3 added.
TODO: 2 of 3 tasks shown
EOF
-test_todo_session 'add with &' <<EOF
->>> todo.sh add "dig the garden & water the flowers"
-4 dig the garden & water the flowers
+test_todo_session 'add with symbols' <<EOF
+>>> todo.sh add "~@#$%^&*()-_=+[{]}|;:',<.>/?"
+4 ~@#$%^&*()-_=+[{]}|;:',<.>/?
TODO: 4 added.
+>>> todo.sh add '\`!\\"'
+5 \`!\\"
+TODO: 5 added.
+
>>> todo.sh list
-4 dig the garden & water the flowers
1 notice the daisies
2 smell the roses
3 smell the uppercase Roses
+5 \`!\\"
+4 ~@#$%^&*()-_=+[{]}|;:',<.>/?
--
-TODO: 4 of 4 tasks shown
-
+TODO: 5 of 5 tasks shown
EOF
test_done
View
64 todo.sh
@@ -207,6 +207,8 @@ help()
-+
Hide project names in list output. Use twice to show project
names (default).
+ -c
+ Color mode
-d CONFIG_FILE
Use a configuration file other than the default ~/.todo/config
-f
@@ -220,12 +222,19 @@ help()
priority labels (default).
-a
Don't auto-archive tasks automatically on completion
+ -A
+ Auto-archive tasks automatically on completion
-n
Don't preserve line numbers; automatically remove blank lines
on task deletion
+ -N
+ Preserve line numbers
-t
Prepend the current date to a task automatically
when it's added.
+ -T
+ Do not prepend the current date to a task automatically
+ when it's added.
-v
Verbose mode turns on confirmation messages
-vv
@@ -237,12 +246,12 @@ help()
Environment variables:
- TODOTXT_AUTO_ARCHIVE=0 is same as option -a
+ TODOTXT_AUTO_ARCHIVE is same as option -a (0)/-A (1)
TODOTXT_CFG_FILE=CONFIG_FILE is same as option -d CONFIG_FILE
TODOTXT_FORCE=1 is same as option -f
- TODOTXT_PRESERVE_LINE_NUMBERS=0 is same as option -n
- TODOTXT_PLAIN=1 is same as option -p
- TODOTXT_DATE_ON_ADD=1 is same as option -t
+ TODOTXT_PRESERVE_LINE_NUMBERS is same as option -n (0)/-N (1)
+ TODOTXT_PLAIN is same as option -p (1)/-c (0)
+ TODOTXT_DATE_ON_ADD is same as option -t (1)/-T (0)
TODOTXT_VERBOSE=1 is same as option -v
TODOTXT_DEFAULT_ACTION="" run this when called with no arguments
TODOTXT_SORT_COMMAND="sort ..." customize list output
@@ -393,8 +402,20 @@ replaceOrPrepend()
fi
}
+#Preserving environment variables so they don't get clobbered by the config file
+OVR_TODOTXT_AUTO_ARCHIVE="$TODOTXT_AUTO_ARCHIVE"
+OVR_TODOTXT_FORCE="$TODOTXT_FORCE"
+OVR_TODOTXT_PRESERVE_LINE_NUMBERS="$TODOTXT_PRESERVE_LINE_NUMBERS"
+OVR_TODOTXT_PLAIN="$TODOTXT_PLAIN"
+OVR_TODOTXT_DATE_ON_ADD="$TODOTXT_DATE_ON_ADD"
+OVR_TODOTXT_DISABLE_FILTER="$TODOTXT_DISABLE_FILTER"
+OVR_TODOTXT_VERBOSE="$TODOTXT_VERBOSE"
+OVR_TODOTXT_DEFAULT_ACTION="$TODOTXT_DEFAULT_ACTION"
+OVR_TODOTXT_SORT_COMMAND="$TODOTXT_SORT_COMMAND"
+OVR_TODOTXT_FINAL_FILTER="$TODOTXT_FINAL_FILTER"
+
# == PROCESS OPTIONS ==
-while getopts ":fhpnatvVx+@Pd:" Option
+while getopts ":fhpcnNaAtTvVx+@Pd:" Option
do
case $Option in
'@' )
@@ -556,7 +577,6 @@ export SENTENCE_DELIMITERS=',.:;'
fi
}
-
if [ -z "$TODO_ACTIONS_DIR" -o ! -d "$TODO_ACTIONS_DIR" ]
then
TODO_ACTIONS_DIR="$HOME/.todo/actions"
@@ -577,6 +597,38 @@ fi
. "$TODOTXT_CFG_FILE"
+# === APPLY OVERRIDES
+if [ -n "$OVR_TODOTXT_AUTO_ARCHIVE" ] ; then
+ TODOTXT_AUTO_ARCHIVE="$OVR_TODOTXT_AUTO_ARCHIVE"
+fi
+if [ -n "$OVR_TODOTXT_FORCE" ] ; then
+ TODOTXT_FORCE="$OVR_TODOTXT_FORCE"
+fi
+if [ -n "$OVR_TODOTXT_PRESERVE_LINE_NUMBERS" ] ; then
+ TODOTXT_PRESERVE_LINE_NUMBERS="$OVR_TODOTXT_PRESERVE_LINE_NUMBERS"
+fi
+if [ -n "$OVR_TODOTXT_PLAIN" ] ; then
+ TODOTXT_PLAIN="$OVR_TODOTXT_PLAIN"
+fi
+if [ -n "$OVR_TODOTXT_DATE_ON_ADD" ] ; then
+ TODOTXT_DATE_ON_ADD="$OVR_TODOTXT_DATE_ON_ADD"
+fi
+if [ -n "$OVR_TODOTXT_DISABLE_FILTER" ] ; then
+ TODOTXT_DISABLE_FILTER="$OVR_TODOTXT_DISABLE_FILTER"
+fi
+if [ -n "$OVR_TODOTXT_VERBOSE" ] ; then
+ TODOTXT_VERBOSE="$OVR_TODOTXT_VERBOSE"
+fi
+if [ -n "$OVR_TODOTXT_DEFAULT_ACTION" ] ; then
+ TODOTXT_DEFAULT_ACTION="$OVR_TODOTXT_DEFAULT_ACTION"
+fi
+if [ -n "$OVR_TODOTXT_SORT_COMMAND" ] ; then
+ TODOTXT_SORT_COMMAND="$OVR_TODOTXT_SORT_COMMAND"
+fi
+if [ -n "$OVR_TODOTXT_FINAL_FILTER" ] ; then
+ TODOTXT_FINAL_FILTER="$OVR_TODOTXT_FINAL_FILTER"
+fi
+
ACTION=${1:-$TODOTXT_DEFAULT_ACTION}
[ -z "$ACTION" ] && usage

0 comments on commit b4617b2

Please sign in to comment.