Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added status messages for listaddons and file test #403

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/t8010-listaddons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This test checks listing of custom actions.

test_todo_session 'no custom actions' <<EOF
>>> todo.sh listaddons
TODO: '$TODO_ACTIONS_DIR' does not exist.
EOF

make_action "foo"
Expand Down
10 changes: 9 additions & 1 deletion todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ _list() {
local FILE="$1"
## If the file starts with a "/" use absolute path. Otherwise,
## try to find it in either $TODO_DIR or using a relative path
if [ "${1:0:1}" == / ]; then
if [ "${1:0:1}" == / ] && [ -f "$FILE" ]; then
## Absolute path
src="$FILE"
elif [ -f "$TODO_DIR/$FILE" ]; then
Expand Down Expand Up @@ -1485,14 +1485,22 @@ note: PRIORITY must be anywhere from A to Z."
"listaddons" )
if [ -d "$TODO_ACTIONS_DIR" ]; then
cd "$TODO_ACTIONS_DIR" || exit $?
VALID=0
chrysle marked this conversation as resolved.
Show resolved Hide resolved
for action in *
do
if [ -f "$action" ] && [ -x "$action" ]; then
echo "$action"
VALID+=1
inkarkat marked this conversation as resolved.
Show resolved Hide resolved
elif [ -d "$action" ] && [ -x "$action/$action" ]; then
echo "$action"
VALID+=1
fi
done
if ! [ "$VALID" -gt 0 ]; then
echo "TODO: '$TODO_ACTIONS_DIR' does not contain valid actions."
fi
else
[ "$TODOTXT_VERBOSE" -gt 0 ] && echo "TODO: '$TODO_ACTIONS_DIR' does not exist."
inkarkat marked this conversation as resolved.
Show resolved Hide resolved
inkarkat marked this conversation as resolved.
Show resolved Hide resolved
fi
;;

Expand Down