echo "${root}"
}
+process_reviewers() {
+ local r arr=()
+ for r in ${*//,/ } ; do
+ case ${r} in
+ *OWNERS)
+ local owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "${r}")
+ if [[ -z ${owners} ]] ; then
+ err "cannot find OWNERS list"
+ else
+ echo "Auto setting reviewers to: ${owners}"
+ fi
+ arr+=( ${owners} )
+ ;;
+ *)
+ arr+=( "${r}" )
+ ;;
+ esac
+ done
+ reviewers=$(printf '%s,' "${arr[@]}")
+ reviewers=${reviewers%,}
+}
+
case ${acmd:-${cmd}} in
rebase)
if [[ $1 == "all" ]] ; then
while [[ $# -gt 0 ]] ; do
case $1 in
--re)
- reviewers=$2
+ process_reviewers "$2"
shift
;;
-n|--dry-run|--draft)
while [[ $# -gt 0 ]] ; do
case $1 in
--re)
- if [[ $2 == *"OWNERS" ]] ; then
- owners=$(awk -F'@' '{list = list "," $1} END {print substr(list, 2)}' "$2")
- if [[ -z ${owners} ]] ; then
- err "cannot find OWNERS list"
- else
- echo "Auto setting reviewers to: ${owners}"
- fi
- args+=( --re "${owners}" )
- shift 2
- continue
- fi
+ process_reviewers "$2"
+ args+=( --re "${reviewers}" )
+ shift 2
+ continue
;;
esac
args+=( "$1" )