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.
9
9
10
10
test_todo_session ' no custom actions' << EOF
11
11
>>> todo.sh listaddons
12
+ TODO: '$TODO_ACTIONS_DIR ' does not exist.
13
+ === 1
12
14
EOF
13
15
14
16
make_action " foo"
15
17
test_todo_session ' one custom action' << EOF
16
18
>>> todo.sh listaddons
17
19
foo
20
+ --
21
+ TODO: 1 valid addon actions found.
18
22
EOF
19
23
20
24
make_action " bar"
26
30
foo
27
31
ls
28
32
quux
33
+ --
34
+ TODO: 4 valid addon actions found.
29
35
EOF
30
36
31
37
invalidate_action .todo.actions.d/foo t8010.4
@@ -34,6 +40,8 @@ test_todo_session 'nonexecutable action' <<EOF
34
40
bar
35
41
ls
36
42
quux
43
+ --
44
+ TODO: 3 valid addon actions found.
37
45
EOF
38
46
39
47
make_action_in_folder " chuck"
59
67
ls
60
68
norris
61
69
quux
70
+ --
71
+ TODO: 5 valid addon actions found.
62
72
EOF
63
73
64
74
invalidate_action .todo.actions.d/norris/norris t8010.8
68
78
chuck
69
79
ls
70
80
quux
81
+ --
82
+ TODO: 4 valid addon actions found.
71
83
EOF
72
84
73
85
test_done
Original file line number Diff line number Diff line change @@ -354,6 +354,7 @@ dieWithHelp()
354
354
355
355
die " $@ "
356
356
}
357
+
357
358
die ()
358
359
{
359
360
echo >&2 " $* "
@@ -878,7 +879,7 @@ _list() {
878
879
local FILE=" $1 "
879
880
# # If the file starts with a "/" use absolute path. Otherwise,
880
881
# # 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
882
883
# # Absolute path
883
884
src=" $FILE "
884
885
elif [ -f " $TODO_DIR /$FILE " ]; then
@@ -1523,14 +1524,27 @@ note: PRIORITY must be anywhere from A to Z."
1523
1524
" listaddons" )
1524
1525
if [ -d " $TODO_ACTIONS_DIR " ]; then
1525
1526
cd " $TODO_ACTIONS_DIR " || exit $?
1527
+ actionsCnt=0
1526
1528
for action in *
1527
1529
do
1528
1530
if [ -f " $action " ] && [ -x " $action " ]; then
1529
1531
echo " $action "
1532
+ (( actionsCnt+= 1 ))
1530
1533
elif [ -d " $action " ] && [ -x " $action /$action " ]; then
1531
1534
echo " $action "
1535
+ (( actionsCnt+= 1 ))
1532
1536
fi
1533
1537
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."
1534
1548
fi
1535
1549
;;
1536
1550
You can’t perform that action at this time.
0 commit comments