|
@ -78,7 +78,7 @@ while getopts "h?s:b:i:r:p:IcCdvo:" opt; do |
|
|
_vcs_only=true |
|
|
_vcs_only=true |
|
|
;; |
|
|
;; |
|
|
o) |
|
|
o) |
|
|
options="$options "$(printf "$OPTARG" | sed -e 's/,/ /g')"" |
|
|
options="$options,$OPTARG" |
|
|
;; |
|
|
;; |
|
|
esac |
|
|
esac |
|
|
done |
|
|
done |
|
@ -148,29 +148,50 @@ option() { |
|
|
shift |
|
|
shift |
|
|
|
|
|
|
|
|
local negate=false |
|
|
local negate=false |
|
|
|
|
|
local variable=false |
|
|
case "$check" in |
|
|
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 negate=true |
|
|
local check="$(printf "$check" | cut -c 2-)" |
|
|
local check="$(echo "$check" | cut -c 2-)" |
|
|
;; |
|
|
;; |
|
|
esac |
|
|
esac |
|
|
|
|
|
|
|
|
local enabled=false |
|
|
local enabled=false |
|
|
local option |
|
|
local opt |
|
|
for option in $options; do |
|
|
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 |
|
|
if [ "$option" = "$check" ]; then |
|
|
local enabled=true |
|
|
local enabled=true |
|
|
break |
|
|
break |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
if [ "$variable" = true ]; then |
|
|
|
|
|
if [ "$enabled" = true ]; then |
|
|
|
|
|
echo "$value" |
|
|
|
|
|
return |
|
|
|
|
|
else |
|
|
|
|
|
echo "$default" |
|
|
|
|
|
return |
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
if [ "$negate" = true ]; then |
|
|
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 |
|
|
[ "$enabled" = true ] && local enabled=false || local enabled=true |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ "$1" ]; then |
|
|
if [ "$1" ]; then |
|
|
[ "$enabled" = true ] && eval $@ || true |
|
|
if [ "$enabled" = true ]; then |
|
|
|
|
|
eval $@ |
|
|
|
|
|
fi |
|
|
else |
|
|
else |
|
|
return $([ "$enabled" = true ]) |
|
|
return $([ "$enabled" = true ]) |
|
|
fi |
|
|
fi |
|
|