From eb33c9bf5a042ecd94a2d94b7f0db74dd1e8cf7b Mon Sep 17 00:00:00 2001 From: spacewander Date: Fri, 20 Dec 2019 18:21:29 +0800 Subject: [PATCH] git-bulk: don't disappoint shellcheck --- bin/git-bulk | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/git-bulk b/bin/git-bulk index 30e2736..a8546b2 100755 --- a/bin/git-bulk +++ b/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