X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fer-close;h=da75efd98120e164c1721c2d6ef171495fda92f0;hb=a5d268ae5f05367aafbd17704e28a6dc495433a4;hp=fa9ffdac5d083080478be31c43b6862a3e8d86d5;hpb=79d03612d0b6ab821c5c6ef7c86a24f45d738960;p=home.git diff --git a/.bin/er-close b/.bin/er-close index fa9ffda..da75efd 100755 --- a/.bin/er-close +++ b/.bin/er-close @@ -1,9 +1,12 @@ #!/bin/bash . ~/.profile.d/gentoo.sh +. ~/.profile.d/aliases.sh op=${0##*/} -op=${op%-close} +ops=( ${op//-/ } ) +op=${ops[0]} +[[ ${op} == "er" ]] && op+=" -q" tdir="${HOME}/.cache/bugz" mkdir -p "${tdir}" find "${tdir}" -mmin +30 -type f -delete @@ -50,6 +53,11 @@ while [[ $# -ne 0 ]] ; do name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -v who -n $xml | \ head -${c} | tail -1 | cut -d@ -f1) fi + new_name=$(echo "${name}" | scrub_html | sed "s: [(\"'][^()\"']*[)\"']::g") + if [[ ${new_name} != "${name}" ]] ; then + echo "Normalizing '${name}' to '${new_name}'" + name=${new_name} + fi if [[ -n ${cl_msg} ]] ; then cl_msg+=" " @@ -72,10 +80,19 @@ doit() { for (( n=0; n < ${#bugs[@]}; ++n )) ; do b=${bugs[$n]} c=${comments[$n]} - run "$@" gbugz -q modify ${b} --fixed -c "\ + local msg="Commit message: $c$(printf '\n%s' ${urls})" + + case ${ops[1]} in + close) + run "$@" gbugz -q modify ${b} --fixed -c "\ should be all set now in the tree; thanks for the report! -Commit message: $c$(printf '\n%s' ${urls})" +${msg}" + ;; + comment) + run "$@" gbugz -q modify ${b} -c "${msg}" + ;; + esac done echo } @@ -100,6 +117,7 @@ case ${g} in t=$(mktemp) echo "${cmds}" > "${t}" ${EDITOR:-nano} "${t}" || rm "${t}" + set -e . "${t}" rm "${t}" ;;