Add taskl function

This commit is contained in:
The Magician 2023-11-21 12:23:13 +00:00
commit 1b62d00350
3 changed files with 43 additions and 0 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
install:
test -d ~/.local/bin/ || mkdir -p ~/.local/bin/
cp generatetask ~/.local/bin/generatetask
chmod +x ~/.local/bin/generatetask
test:
bash_unit tests/test*.sh
testrunner:
find generatetask tests/test*.sh | entr -c bash_unit tests/test*

12
generatetask Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
taskl() {
task \
rc.verbose:nothing \
rc.report.list.columns:id \
rc.report.list.labels:id \
"$@" \
list
}

View File

@ -0,0 +1,23 @@
#!/bin/bash
setup() {
source ../generatetask
}
test_taskl_runs_task_with_correct_parameters() {
fake task 'echo "task ${FAKE_PARAMS[@]}"'
expected="task rc.verbose:nothing rc.report.list.columns:id rc.report.list.labels:id list"
result="$(taskl)"
assert_equals "$expected" "$result"
}
test_taskl_runs_task_with_custom_parameters() {
fake task 'echo "task ${FAKE_PARAMS[@]}"'
expected="task rc.verbose:nothing rc.report.list.columns:id rc.report.list.labels:id +ACTIVE -BLOCKED list"
result="$(taskl +ACTIVE -BLOCKED)"
assert_equals "$expected" "$result"
}