File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,16 @@ This test checks listing of custom actions.
99
1010test_todo_session ' no custom actions' << EOF
1111>>> todo.sh listaddons
12+ TODO: '$TODO_ACTIONS_DIR ' does not exist.
13+ === 1
1214EOF
1315
1416make_action " foo"
1517test_todo_session ' one custom action' << EOF
1618>>> todo.sh listaddons
1719foo
20+ --
21+ TODO: 1 valid addon actions found.
1822EOF
1923
2024make_action " bar"
2630foo
2731ls
2832quux
33+ --
34+ TODO: 4 valid addon actions found.
2935EOF
3036
3137invalidate_action .todo.actions.d/foo t8010.4
@@ -34,6 +40,8 @@ test_todo_session 'nonexecutable action' <<EOF
3440bar
3541ls
3642quux
43+ --
44+ TODO: 3 valid addon actions found.
3745EOF
3846
3947make_action_in_folder " chuck"
5967ls
6068norris
6169quux
70+ --
71+ TODO: 5 valid addon actions found.
6272EOF
6373
6474invalidate_action .todo.actions.d/norris/norris t8010.8
6878chuck
6979ls
7080quux
81+ --
82+ TODO: 4 valid addon actions found.
7183EOF
7284
7385test_done
Original file line number Diff line number Diff line change @@ -354,6 +354,7 @@ dieWithHelp()
354354
355355 die " $@ "
356356}
357+
357358die ()
358359{
359360 echo >&2 " $* "
@@ -878,7 +879,7 @@ _list() {
878879 local FILE=" $1 "
879880 # # If the file starts with a "/" use absolute path. Otherwise,
880881 # # try to find it in either $TODO_DIR or using a relative path
881- if [ " ${1: 0: 1} " == / ]; then
882+ if [ " ${1: 0: 1} " == / ] && [ -f " $FILE " ] ; then
882883 # # Absolute path
883884 src=" $FILE "
884885 elif [ -f " $TODO_DIR /$FILE " ]; then
@@ -1523,14 +1524,27 @@ note: PRIORITY must be anywhere from A to Z."
15231524" listaddons" )
15241525 if [ -d " $TODO_ACTIONS_DIR " ]; then
15251526 cd " $TODO_ACTIONS_DIR " || exit $?
1527+ actionsCnt=0
15261528 for action in *
15271529 do
15281530 if [ -f " $action " ] && [ -x " $action " ]; then
15291531 echo " $action "
1532+ (( actionsCnt+= 1 ))
15301533 elif [ -d " $action " ] && [ -x " $action /$action " ]; then
15311534 echo " $action "
1535+ (( actionsCnt+= 1 ))
15321536 fi
15331537 done
1538+ if ! [ " $actionsCnt " -gt 0 ]; then
1539+ die " TODO: '$TODO_ACTIONS_DIR ' does not contain valid actions."
1540+ else
1541+ if [ " $TODOTXT_VERBOSE " -gt 0 ]; then
1542+ echo " --"
1543+ echo " TODO: $actionsCnt valid addon actions found."
1544+ fi
1545+ fi
1546+ else
1547+ die " TODO: '$TODO_ACTIONS_DIR ' does not exist."
15341548 fi
15351549 ;;
15361550
You can’t perform that action at this time.
0 commit comments