Use descriptive parameter names for Usage()

This commit is contained in:
Raphaël Hertzog 2020-04-23 16:38:59 +02:00
parent b3bba232ac
commit 4c75f80e67
18 changed files with 34 additions and 25 deletions

View File

@ -25,7 +25,7 @@ Arguments frontend "${@}"
eval set -- "${REMAINING_ARGS}"
if [ -z "${1}" ]; then
Usage 1
Usage --fail
fi
COMMAND="${1}"

View File

@ -127,7 +127,7 @@ Arguments ()
fi
exit 0
elif [ "${IS_FRONTEND}" = "true" ]; then
Usage 0
Usage --exit
fi
;;
@ -137,7 +137,7 @@ Arguments ()
;;
-u|--usage)
Usage 0
Usage --exit
shift
;;

View File

@ -11,10 +11,6 @@
Usage ()
{
if [ -z "${1}" ]; then
Echo_error "Usage() requires an exit code"
fi
echo "${PROGRAM_NAME} - ${DESCRIPTION}"
printf "\nUsage:\n\n"
@ -29,5 +25,18 @@ Usage ()
echo
echo "Try \"${PROGRAM} --help\" for more information."
exit $1
case $1 in
--fail)
exit 1
;;
--exit)
exit 0
;;
"")
:
;;
*)
Echo_error "Unexpected parameter to Usage(): $1"
;;
esac
}

View File

@ -217,6 +217,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -23,7 +23,7 @@ _ACTION="${2}"
shift 2
if ! In_list "${_PASS}" "binary" "chroot" "source"; then
Usage 1
Usage --fail
fi
# Processing arguments and configuration files
@ -441,6 +441,6 @@ case "${_ACTION}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -67,6 +67,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -63,6 +63,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -84,6 +84,6 @@ EOF
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -77,6 +77,6 @@ EOF
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -83,6 +83,6 @@ EOF
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -67,6 +67,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -95,6 +95,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -64,6 +64,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -61,6 +61,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -73,6 +73,6 @@ EOF
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -66,6 +66,6 @@ case "${1}" in
;;
*)
Usage 1
Usage --fail
;;
esac

View File

@ -144,7 +144,7 @@ do
;;
-u|--usage)
Usage 0
Usage --exit
;;
-v|--version)
@ -153,7 +153,7 @@ do
;;
*)
Usage 1
Usage --fail
;;
esac
done

View File

@ -294,7 +294,7 @@ Local_arguments ()
;;
-u|--usage)
Usage 0
Usage --exit
shift
;;