options: de-duplicate common option handling
This commit is contained in:
parent
55e17b1e25
commit
22d8ac15db
|
@ -28,60 +28,11 @@ Arguments ()
|
|||
while true
|
||||
do
|
||||
case "${1}" in
|
||||
--breakpoints)
|
||||
_BREAKPOINTS="true"
|
||||
--breakpoints|--color|--debug|--force|-h|--help|--no-color|--quiet|-u|--usage|--verbose|-v|--version)
|
||||
Handle_common_option "${1}"
|
||||
shift
|
||||
;;
|
||||
|
||||
--color)
|
||||
_COLOR="true"
|
||||
_COLOR_OUT="true"
|
||||
_COLOR_ERR="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
--no-color)
|
||||
_COLOR="false"
|
||||
_COLOR_OUT="false"
|
||||
_COLOR_ERR="false"
|
||||
shift
|
||||
;;
|
||||
|
||||
--debug)
|
||||
_DEBUG="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
--force)
|
||||
_FORCE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
Man
|
||||
shift
|
||||
;;
|
||||
|
||||
--quiet)
|
||||
_QUIET="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-u|--usage)
|
||||
Usage --exit
|
||||
shift
|
||||
;;
|
||||
|
||||
--verbose)
|
||||
_VERBOSE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
|
@ -94,3 +45,58 @@ Arguments ()
|
|||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Handle_common_option ()
|
||||
{
|
||||
case "${1}" in
|
||||
--breakpoints)
|
||||
_BREAKPOINTS="true"
|
||||
;;
|
||||
|
||||
--color)
|
||||
_COLOR="true"
|
||||
_COLOR_OUT="true"
|
||||
_COLOR_ERR="true"
|
||||
;;
|
||||
|
||||
--no-color)
|
||||
_COLOR="false"
|
||||
_COLOR_OUT="false"
|
||||
_COLOR_ERR="false"
|
||||
;;
|
||||
|
||||
--debug)
|
||||
_DEBUG="true"
|
||||
;;
|
||||
|
||||
--force)
|
||||
_FORCE="true"
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
Man
|
||||
;;
|
||||
|
||||
--quiet)
|
||||
_QUIET="true"
|
||||
;;
|
||||
|
||||
-u|--usage)
|
||||
Usage --exit
|
||||
;;
|
||||
|
||||
--verbose)
|
||||
_VERBOSE="true"
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
Echo_error "Internal error: Unknown common option '%s'" "${1}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -256,8 +256,8 @@ Local_arguments ()
|
|||
|
||||
# General options
|
||||
|
||||
--breakpoints)
|
||||
_BREAKPOINTS="true"
|
||||
--breakpoints|--debug|--force|-h|--help|--quiet|-u|--usage|--verbose|-v|--version)
|
||||
Handle_common_option "${1}"
|
||||
shift
|
||||
;;
|
||||
|
||||
|
@ -266,46 +266,11 @@ Local_arguments ()
|
|||
shift
|
||||
;;
|
||||
|
||||
--debug)
|
||||
_DEBUG="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
--force)
|
||||
_FORCE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
Man
|
||||
shift
|
||||
;;
|
||||
|
||||
--no-color)
|
||||
_COLOR="false"
|
||||
shift
|
||||
;;
|
||||
|
||||
--quiet)
|
||||
_QUIET="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-u|--usage)
|
||||
Usage --exit
|
||||
shift
|
||||
;;
|
||||
|
||||
--verbose)
|
||||
_VERBOSE="true"
|
||||
shift
|
||||
;;
|
||||
|
||||
-v|--version)
|
||||
echo "${VERSION}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
# Build config options
|
||||
|
||||
--apt)
|
||||
|
|
Loading…
Reference in New Issue