diff options
Diffstat (limited to 'requirements/scripts/req-list')
| -rwxr-xr-x | requirements/scripts/req-list | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/requirements/scripts/req-list b/requirements/scripts/req-list index 29e1795..c1d8e37 100755 --- a/requirements/scripts/req-list +++ b/requirements/scripts/req-list @@ -13,19 +13,29 @@ Usage: req.sh list [options...] <type> [id] options: -D lists incomplete tasks or epics + -e lists items which match the given Epic ID + -E lists items which do NOT match the given Epic ID -S lists unsatisfied requirements -p lists requirements sourced from [id] -P lists unsourced requirements " } -while getopts ":D:S:P:p" o +while getopts ":D:E:e:S:P:p" o do case "$o" in D) incomplete=1 shift 1 ;; + E) + not_epic=1 + shift 1 + ;; + e) + epic=1 + shift 1 + ;; S) unsatisfied=1 shift 1 @@ -49,6 +59,15 @@ done type="$1" id="$2" +if [ "$epic" == 1 ] || [ "$not_epic" == 1 ] +then + if [[ "$type" =~ ^[0-9][0-9][0-9]$ ]] + then + id="$task" + type=task + fi +fi + if [ "$type" == "" ] then echo "ERROR: you didn't provide a type!" @@ -73,10 +92,47 @@ case "$type" in dir="${requirements_dir}/tasks" ;; *) + echo "ERROR: ${type} is not a valid type! Try: req | dml | ass | need | task | epic" usage exit 1 esac +if [ "$epic" == 1 ] +then + echo " +${type} items matching Epic id epic-*${id} +--------------------------------------------------------------------------- +" + filenames=(${dir}/${type}-*.md) + for filename in "${filenames[@]}" + do + matches_epic="$(cat $filename | grep -E "^Epic:.*\bepic-*${id}\b")" + if [ -n "$matches_epic" ] + then + echo "$(basename "$filename" | sed "s/.md$//")" + fi + done + echo "" +fi + +if [ "$not_epic" == 1 ] +then + echo " +${type} items not matching Epic id epic-*${id} +--------------------------------------------------------------------------- +" + filenames=(${dir}/${type}-*.md) + for filename in "${filenames[@]}" + do + matches_epic="$(cat $filename | grep -E "^Epic:.*\bepic-*${id}\b")" + if [ -z "$matches_epic" ] + then + echo "$(basename "$filename" | sed "s/.md$//")" + fi + done + echo "" +fi + if [ "$incomplete" == 1 ] then echo " @@ -153,6 +209,8 @@ fi if \ [ "$incomplete" == "" ] \ && [ "$sourced" == "" ] \ + && [ "$epic" == "" ] \ + && [ "$not_epic" == "" ] \ && [ "$unsatisfied" == "" ] \ && [ "$unsourced" == "" ] then |
