|
|
@ -78,7 +78,7 @@ while getopts "h?s:b:i:r:p:IcCdvo:" opt; do |
|
|
|
_vcs_only=true |
|
|
|
;; |
|
|
|
o) |
|
|
|
options="$options "$(printf "$OPTARG" | sed -e 's/,/ /g')"" |
|
|
|
options="$options,$OPTARG" |
|
|
|
;; |
|
|
|
esac |
|
|
|
done |
|
|
@ -148,29 +148,50 @@ option() { |
|
|
|
shift |
|
|
|
|
|
|
|
local negate=false |
|
|
|
local variable=false |
|
|
|
case "$check" in |
|
|
|
*=*) |
|
|
|
local variable=true |
|
|
|
local default="$(echo "$check" | cut -d '=' -f 2)" |
|
|
|
local check="$(echo "$check" | cut -d '=' -f 1)" |
|
|
|
;; |
|
|
|
!*) |
|
|
|
local negate=true |
|
|
|
local check="$(printf "$check" | cut -c 2-)" |
|
|
|
local check="$(echo "$check" | cut -c 2-)" |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
local enabled=false |
|
|
|
local option |
|
|
|
for option in $options; do |
|
|
|
local opt |
|
|
|
local IFS=','; for opt in $options; do |
|
|
|
local option="$(echo "$opt" | cut -d '=' -f 1)" |
|
|
|
local value="$(echo "$opt" | cut -d '=' -f 2)" |
|
|
|
|
|
|
|
if [ "$option" = "$check" ]; then |
|
|
|
local enabled=true |
|
|
|
break |
|
|
|
fi |
|
|
|
done |
|
|
|
|
|
|
|
if [ "$variable" = true ]; then |
|
|
|
if [ "$enabled" = true ]; then |
|
|
|
echo "$value" |
|
|
|
return |
|
|
|
else |
|
|
|
echo "$default" |
|
|
|
return |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$negate" = true ]; then |
|
|
|
# Shitty way to do a simple "NOT" operation (come on, it's just one operation on most cpus). |
|
|
|
# Shitty way to do a simple "NOT" operation. |
|
|
|
[ "$enabled" = true ] && local enabled=false || local enabled=true |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$1" ]; then |
|
|
|
[ "$enabled" = true ] && eval $@ || true |
|
|
|
if [ "$enabled" = true ]; then |
|
|
|
eval $@ |
|
|
|
fi |
|
|
|
else |
|
|
|
return $([ "$enabled" = true ]) |
|
|
|
fi |
|
|
|