From f44bcfb06788b72b9c32561b446762b03579f462 Mon Sep 17 00:00:00 2001 From: Paul Mansfield Date: Fri, 4 Sep 2009 12:23:48 +0100 Subject: [PATCH 1/2] Bug Fix, better fix for "add does not escape line breaks" Now removes windows and unix style line breaks. Each test has a windows and a unix style line break. --- tests/t2000-multiline.sh | 20 ++++++++++++-------- todo.sh | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/t2000-multiline.sh b/tests/t2000-multiline.sh index b9fe7b2..40c7e15 100755 --- a/tests/t2000-multiline.sh +++ b/tests/t2000-multiline.sh @@ -8,7 +8,7 @@ test_description='Multi-line functionality' # Create the expected file echo "1: smell the cheese replaced with -1: eat apples eat oranges">$HOME/expect.multi +1: eat apples eat oranges drink milk">$HOME/expect.multi test_expect_success 'multiline item replace' ' ( @@ -18,7 +18,8 @@ cat /dev/null > $HOME/todo.txt # Run replace "$HOME/bin/todo.sh" replace 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -32,7 +33,7 @@ fi ## Add test # Create the expected file -echo "TODO: 'eat apples eat oranges' added on line 2.">$HOME/expect.multi +echo "TODO: 'eat apples eat oranges drink milk' added on line 2.">$HOME/expect.multi test_expect_success 'multiline item add' ' ( @@ -42,7 +43,8 @@ cat /dev/null > $HOME/todo.txt # Run add "$HOME/bin/todo.sh" add "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -56,7 +58,7 @@ fi ## Append test # Create the expected file -echo "1: smell the cheese eat apples eat oranges">$HOME/expect.multi +echo "1: smell the cheese eat apples eat oranges drink milk">$HOME/expect.multi test_expect_success 'multiline item append' ' ( @@ -66,7 +68,8 @@ cat /dev/null > $HOME/todo.txt # Run append "$HOME/bin/todo.sh" append 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -80,7 +83,7 @@ fi ## Prepend test # Create the expected file -echo "1: eat apples eat oranges smell the cheese">$HOME/expect.multi +echo "1: eat apples eat oranges drink milk smell the cheese">$HOME/expect.multi test_expect_success 'multiline item prepend' ' ( @@ -90,7 +93,8 @@ cat /dev/null > $HOME/todo.txt # Run prepend "$HOME/bin/todo.sh" prepend 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" diff --git a/todo.sh b/todo.sh index 4593286..4750bb1 100755 --- a/todo.sh +++ b/todo.sh @@ -244,7 +244,7 @@ cleaninput() { # Cleanup the input # Replace newlines with spaces - input=`echo $input | tr -d '\n'` + input=`echo $input | tr -d '\r|\n'` } archive() From 5e71728cda6fdfe07aa19769ccedac497e34871c Mon Sep 17 00:00:00 2001 From: Paul Mansfield Date: Fri, 4 Sep 2009 13:37:07 +0100 Subject: [PATCH 2/2] Added a new variable $TODO_FULL_SH This gives access to the full path of the script. It may prove useful for addon developers to rerun todo.sh from within their addons, in order to populate variables for context, projects etc. As we have the config and actions directory available via variables, this is a missing piece. --- todo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/todo.sh b/todo.sh index 4750bb1..22d5285 100755 --- a/todo.sh +++ b/todo.sh @@ -17,9 +17,10 @@ EndVersion exit 1 } -# Set script name early. +# Set script name and full path early. TODO_SH=$(basename "$0") -export TODO_SH +TODO_FULL_SH="$0" +export TODO_SH TODO_FULL_SH oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_description]"