#!/usr/bin/env zsh # Usage: list [[!]tag-expr ...] # List all issues. If tag-expr is specified, then include issues only # with at least one tag satisfying tag-expr. tag-expr is an expression # tag is compared with. If "!" is prepended to tag-expr, then it excludes # issues. root=$0:h:a . $root/lib.zsh.rc tagsOur=($@) tagsSatisfied() { local tagsTheir=($@) for our ($tagsOur) { [[ ${our[1]} = "!" ]] || continue for their ($tagsTheir) { if [[ $their =~ ${our[2,-1]} ]]; then return 1 fi } } for our ($tagsOur) { [[ ${our[1]} != "!" ]] || continue local satisfied=0 for their ($tagsTheir) { if [[ $their =~ $our ]]; then satisfied=1 break fi } [[ $satisfied -eq 1 ]] || return 1 } } for issue (issues/*(On)) { issue=$issue:t issue=${issue#issues/} tagsTheir=(`$root/tag-list $issue`) tagsSatisfied $tagsTheir || continue print -n $issue "| " print $tagsTheir } | colourise green:"^.{19}" bg-cyan:"\|" red:"proj:[^ ]+"