#!/bin/sh test_description='custom actions functionality This test covers the contract between todo.sh and custom actions. ' . ./test-lib.sh unset TODO_ACTIONS_DIR mkdir .todo.actions.d make_action() { cat > ".todo.actions.d/$1" <<- EOF #!/bin/bash echo "custom action $1" EOF chmod +x ".todo.actions.d/$1" } make_action "foo" test_todo_session 'executable action' <>> todo.sh foo custom action foo EOF chmod -x .todo.actions.d/foo test_todo_session 'nonexecutable action' <>> todo.sh foo Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description] Try 'todo.sh -h' for more information. === 1 EOF make_action "ls" test_todo_session 'overriding built-in action' <>> todo.sh ls custom action ls >>> todo.sh command ls -- TODO: 0 of 0 tasks shown EOF make_action "bad" echo "exit 42" >> .todo.actions.d/bad test_todo_session 'failing action' <>> todo.sh bad custom action bad === 42 EOF test_done