summaryrefslogtreecommitdiff
path: root/requirements/scripts/req-list
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-07-18 20:55:23 +0100
committerJoe Carstairs <me@joeac.net>2025-07-18 20:55:23 +0100
commitafc8e3262973bbdf22b6e7838e0a27b871d83d86 (patch)
tree9e2614a0f76f41446601f3009f4e743a6205b067 /requirements/scripts/req-list
parent7f68a8f63bd389837165e8c75eab3be5e0afa716 (diff)
add req.sh list option: D
Diffstat (limited to 'requirements/scripts/req-list')
-rwxr-xr-xrequirements/scripts/req-list37
1 files changed, 34 insertions, 3 deletions
diff --git a/requirements/scripts/req-list b/requirements/scripts/req-list
index 5641734..29e1795 100755
--- a/requirements/scripts/req-list
+++ b/requirements/scripts/req-list
@@ -7,20 +7,25 @@ usage()
echo "
Usage: req.sh list [options...] <type> [id]
- type: req | dml | ass | need
+ type: req | dml | ass | need | task | epic
id: filters items for the given id
options:
+ -D lists incomplete tasks or epics
-S lists unsatisfied requirements
-p lists requirements sourced from [id]
-P lists unsourced requirements
"
}
-while getopts ":S:P:p" o
+while getopts ":D:S:P:p" o
do
case "$o" in
+ D)
+ incomplete=1
+ shift 1
+ ;;
S)
unsatisfied=1
shift 1
@@ -64,11 +69,33 @@ case "$type" in
need)
dir="${requirements_dir}/needs"
;;
+ task | epic)
+ dir="${requirements_dir}/tasks"
+ ;;
*)
usage
exit 1
esac
+if [ "$incomplete" == 1 ]
+then
+ echo "
+incomplete ${type} items matching id ${type}-*${id}
+---------------------------------------------------------------------------
+"
+ filenames=(${dir}/${type}-*.md)
+ for filename in "${filenames[@]}"
+ do
+ is_complete="$(cat $filename | grep -E "^Status: (done|complete|completed)$")"
+ if [ -z "$is_complete" ]
+ then
+ echo "$(basename "$filename" | sed "s/.md$//")"
+ fi
+ done
+ echo ""
+fi
+
+
if [ "$sourced" == 1 ]
then
echo "
@@ -123,7 +150,11 @@ Unsourced ${type} items matching id *${id}
echo ""
fi
-if [ "$sourced" == "" ] && [ "$unsatisfied" == "" ] && [ "$unsourced" == "" ]
+if \
+ [ "$incomplete" == "" ] \
+ && [ "$sourced" == "" ] \
+ && [ "$unsatisfied" == "" ] \
+ && [ "$unsourced" == "" ]
then
echo "
All ${type} items matching id *${id}