Printing usage message if no ITEM# given to "todo.sh do".

This commit is contained in:
Ingo Karkat
2010-05-25 10:10:09 +02:00
parent edac86a94d
commit 9e5e6aef39
2 changed files with 7 additions and 0 deletions

View File

@@ -12,6 +12,12 @@ usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
=== 1 === 1
EOF EOF
test_todo_session 'do missing ITEM#' <<EOF
>>> todo.sh do
usage: todo.sh do ITEM#[, ITEM#, ITEM#, ...]
=== 1
EOF
cat > todo.txt <<EOF cat > todo.txt <<EOF
smell the uppercase Roses +flowers @outside smell the uppercase Roses +flowers @outside
notice the sunflowers notice the sunflowers

View File

@@ -768,6 +768,7 @@ case $action in
errmsg="usage: $TODO_SH do ITEM#[, ITEM#, ITEM#, ...]" errmsg="usage: $TODO_SH do ITEM#[, ITEM#, ITEM#, ...]"
# shift so we get arguments to the do request # shift so we get arguments to the do request
shift; shift;
[ "$#" -eq 0 ] && die "$errmsg"
# Split multiple do's, if comma seperated change to whitespace sepereated # Split multiple do's, if comma seperated change to whitespace sepereated
# Loop the 'do' function for each item # Loop the 'do' function for each item