From fee3133547e41161a77987f3d0513828e5a81855 Mon Sep 17 00:00:00 2001 From: Emil Sit Date: Sat, 18 Apr 2009 21:11:27 -0400 Subject: [PATCH] Uniformly use $TODO_SH to refer to script. Set $TODO_SH to just be $(basename "$0") at the beginning of the script and use it in all usage messages. This happens to simplify testing because it allows us to refer to the script as "todo.sh" in all output. For general use, if the user has aliased to file to something else, the usage messages will still reflect that alias. Signed-off-by: Emil Sit --- tests/t1100-replace.sh | 2 +- tests/t1200-pri.sh | 2 +- tests/t9999-testsuite_example.sh | 2 +- todo.sh | 35 ++++++++++++++++---------------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/t1100-replace.sh b/tests/t1100-replace.sh index d198bd7..d3e32d3 100755 --- a/tests/t1100-replace.sh +++ b/tests/t1100-replace.sh @@ -14,7 +14,7 @@ todo.sh add notice the daisies > /dev/null test_todo_session 'replace usage' <>> todo.sh replace adf asdfa === 1 -usage: $(which todo.sh) replace ITEM# "UPDATED ITEM" +usage: todo.sh replace ITEM# "UPDATED ITEM" EOF test_todo_session 'basic replace' <>> todo.sh pri B B -usage: $HOME/bin/todo.sh pri ITEM# PRIORITY +usage: todo.sh pri ITEM# PRIORITY note: PRIORITY must be anywhere from A to Z. === 1 EOF diff --git a/tests/t9999-testsuite_example.sh b/tests/t9999-testsuite_example.sh index cf841f9..03c7353 100755 --- a/tests/t9999-testsuite_example.sh +++ b/tests/t9999-testsuite_example.sh @@ -92,7 +92,7 @@ TODO: Report file updated. 2009-02-13-04:40:00 5 1 >>> todo.sh append g a -usage: $HOME/bin/todo.sh append ITEM# "TEXT TO APPEND" +usage: todo.sh append ITEM# "TEXT TO APPEND" === 1 >>> todo.sh append 2 and think diff --git a/todo.sh b/todo.sh index 347da47..fc41daa 100755 --- a/todo.sh +++ b/todo.sh @@ -17,13 +17,17 @@ EndVersion exit 1 } -oneline_usage="todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]" +# Set script name early. +TODO_SH=$(basename "$0") +export TODO_SH + +oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_description]" usage() { sed -e 's/^ //' <