add gitr which recursively executes git commands

This commit is contained in:
hophacker 2019-07-24 13:27:22 +08:00 committed by wsq
parent 0a1b93900e
commit 5d0c82a79d

View File

@ -135,8 +135,7 @@ function init_db() {
dc exec $1 rails db:drop db:create db:migrate db:seed
}
function cmd_exists() {
cmd=$1
$cmd &> /dev/null;
$* &> /dev/null
if [[ $? == 0 ]]; then
echo Y
else
@ -181,6 +180,19 @@ function qshell_upload() {
qshell rput $bucket $key $filepath
}
function gitr() {
args=$*
for dir in `ls`; do
if [[ -d "$dir" && -d "$dir/.git" ]]; then
pushd .
echo "${GREEN}$(basename $dir)${NC}"
cd $dir
git $args
popd
fi
done
}
function gitcopy() {
n=1
while getopts "c:n:t:T" o; do