d371d80af2
For short single commands, prefer a one-liner `for` with the zsh syntax: ``` for x (foo bar) print ${x} ``` Otherwise just place `; do` on the same line as the POSIX `for ... in`: ``` for x in foo bar; do print ${x} done ``` Closes #268
14 lines
435 B
Bash
14 lines
435 B
Bash
# vim:et sts=2 sw=2 ft=zsh
|
|
local -a remotes
|
|
if (( ${*[(I)(-r|--remotes)]} )); then
|
|
remotes=(${^*:#-*})
|
|
else
|
|
remotes=(${(f)"$(command git rev-parse --abbrev-ref ${^*:#-*}@{u} 2>/dev/null)"})
|
|
fi
|
|
if command git branch --delete ${@} && \
|
|
(( ${#remotes[@]} )) && \
|
|
read -q "?Also delete remote branch(es) ${remotes} [y/N]? "; then
|
|
print
|
|
local remote
|
|
for remote (${remotes}) command git push ${remote%%/*} :${remote#*/}
|
|
fi
|