This commit is contained in:
Dict Xiong 2022-11-15 23:14:40 +08:00
parent b2a1896cb9
commit d485f1d8c2

View File

@ -102,10 +102,11 @@ if [[ "$EUID" != "0" && -x $(command -v sudo) ]]; then
SUDO='sudo'
fi
# arg parse
ARG=""
ARG_PARSED=()
while [[ $# > 0 || -n "$ARG" ]]; do
parse_arg()
{
local ORIGIN_ARG ARG=""
ARG_PARSED=()
while [[ $# > 0 || -n "$ARG" ]]; do
if [[ -z "$ARG" ]]; then ARG=$1 ORIGIN_ARG=$1; shift; fi
case $ARG in
-q*|--quite ) export DFS_QUIET=1 ;;
@ -118,9 +119,8 @@ while [[ $# > 0 || -n "$ARG" ]]; do
else
ARG=-${ARG:2}
fi
done
unset ARG ORIGIN_ARG
done
}
ask_for_yN()
{
@ -190,4 +190,5 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
$1 "${@:2}"
else
setup_color
parse_arg "$@"
fi