Get the test to run

This commit is contained in:
Jeremy Gardais 2020-02-27 15:58:06 +01:00
parent d14839762a
commit fafd2cfc20
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 21 additions and 4 deletions

View File

@ -40,12 +40,12 @@ EXAMPLE:
HELP HELP
} }
## ]]] ## ]]]
## Check the arguments [[[ ## Manage the arguments [[[
check_arguments() { manage_arguments() {
_nb_arg="${#}" _nb_arg="${#}"
_all_args="${*}" _all_args="${*}"
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: check_arguments func ${_nb_arg} argument(s) to manage. List:\n ${_all_args}" [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: manage_arguments func ${_nb_arg} argument(s) to manage. List:\n ${_all_args}"
## If help is needed [[[ ## If help is needed [[[
if printf -- '%s' "${_all_args}" | grep -q -E -- "-h|--help|help"; then if printf -- '%s' "${_all_args}" | grep -q -E -- "-h|--help|help"; then
@ -55,6 +55,23 @@ check_arguments() {
exit 0 exit 0
fi fi
## ]]] ## ]]]
# Manage arguments [[[
case "${_nb_arg}" in
0 )
## Set test to run to default (short)
test_to_run="short"
;;
1 )
test_to_run="${1}"
;;
* )
## More than managed number of arguments
print_help_message
exit 2
;;
esac
# ]]]
} }
## ]]] ## ]]]
## Test if a disk really support SMART [[[ ## Test if a disk really support SMART [[[
@ -119,7 +136,7 @@ choose_correct_type() {
} }
## ]]] ## ]]]
check_arguments "${@}" manage_arguments "${@}"
# Create files # Create files
true > "${smart_device_list}" true > "${smart_device_list}"