Update template

This commit is contained in:
gardouille 2023-04-28 14:48:32 +02:00
parent 63af38d223
commit e1794dfbf6
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 29 additions and 4 deletions

View File

@ -100,14 +100,39 @@ define_vars() { # {{{
}
# }}}
is_command_available() { # {{{
local_command_available_cmd="${1}"
debug_prefix="${2:-}"
## Return False by default
return_command_available="1"
if [ "$(command -v ${local_command_available_cmd})" ]; then
debug_message "${debug_prefix}is_command_available \
${RED}${local_command_available_cmd}${COLOR_DEBUG} seems present on this host."
return_command_available="0"
else
debug_message "${debug_prefix}is_command_available \
${RED}${local_command_available_cmd}${COLOR_DEBUG} is not available on this host."
return_command_available="1"
fi
unset local_command_available_cmd
unset debug_prefix
return "${return_command_available}"
}
# }}}
main() { # {{{
debug_message "--- MAIN BEGIN"
## If script should not be executed right now {{{
### Exit
is_script_ok \
&& exit 0
## If a command is missing {{{
### Exit with error message
is_command_available "test_me" "| " \
|| error_message "No test_me command available. Please install test_me package with your package manager." 01
## }}}
## Define all vars