mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
git-bulk: don't disappoint shellcheck
This commit is contained in:
parent
bd8fa031cc
commit
eb33c9bf5a
28
bin/git-bulk
28
bin/git-bulk
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
inverse=$(tput rev)
|
||||
reset=$(tput sgr0)
|
||||
txtbld=$(tput bold)
|
||||
bldred=${txtbld}$(tput setaf 1)
|
||||
txtbld=$(tput bold)
|
||||
bldred=${txtbld}$(tput setaf 1)
|
||||
|
||||
# default option settings
|
||||
guardedmode=false
|
||||
|
|
@ -82,7 +82,7 @@ function checkWSName () {
|
|||
if [[ $rwsname == "$wsname" ]]; then return; fi
|
||||
done <<< "$(echo "$(listall)")"
|
||||
# when here the ws name was not found
|
||||
usage && echo "error: unknown workspace name: $wsname" && exit 1
|
||||
usage && echo "error: unknown workspace name: $wsname" && exit 1
|
||||
}
|
||||
|
||||
# parse out wsname from workspacespec
|
||||
|
|
@ -109,7 +109,7 @@ function allowedargcount () {
|
|||
if [ $paramcount -ne $1 ] && [ $paramcount -ne $2 ]; then
|
||||
echo 1>&2 "error: wrong number of arguments" && usage;
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# execute the bulk operation
|
||||
|
|
@ -130,8 +130,8 @@ function executBulkOp () {
|
|||
echo "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
|
||||
guardedExecution
|
||||
eval cd "\"$rwsdir\"" # back to origin location of last find command
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
paramcount="${#}"
|
||||
|
|
@ -145,19 +145,19 @@ while [ "${#}" -ge 1 ] ; do
|
|||
--listall|--purge)
|
||||
butilcommand="${1:2}" && break ;;
|
||||
--removeworkspace|--addcurrent|--addworkspace)
|
||||
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4"=="--from" ]; then source="$5"; fi && break ;;
|
||||
-a)
|
||||
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4" == "--from" ]; then source="$5"; fi && break ;;
|
||||
-a)
|
||||
allwsmode=true ;;
|
||||
-g)
|
||||
-g)
|
||||
guardedmode=true ;;
|
||||
-w)
|
||||
-w)
|
||||
singlemode=true && shift && wsname="$1" && checkWSName ;;
|
||||
-*)
|
||||
-*)
|
||||
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
|
||||
--*)
|
||||
--*)
|
||||
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
|
||||
*) # git core commands
|
||||
butilcommand="executBulkOp" && corecommand="$1" && gitcommand="$@" && break ;;
|
||||
butilcommand="executBulkOp" && corecommand="$1" && gitcommand="$*" && break ;;
|
||||
esac && shift
|
||||
done
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ done
|
|||
if $allwsmode && $singlemode; then echo 1>&2 "error: options -w and -a are incompatible" && exit 1; fi
|
||||
|
||||
# if single mode check the supplied workspace name
|
||||
if $singlemode; then echo "Selected single workspace mode in workspace: $wsname" && checkWSName; fi
|
||||
if $singlemode; then echo "Selected single workspace mode in workspace: $wsname" && checkWSName; fi
|
||||
|
||||
# check right number of arguments
|
||||
case $butilcommand in
|
||||
|
|
|
|||
Loading…
Reference in a new issue