#!/usr/bin/env bash # Derived from https://github.com/alphabetum/bash-boilerplate # Strict Mode set -o nounset # Exit immediately if a pipeline returns non-zero. set -o errexit # Print a helpful message if a pipeline with non-zero exit code causes the # script to exit as described above. trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR # Allow the above trap be inherited by all functions in the script. # Short form: set -E set -o errtrace # Return value of a pipeline is the value of the last (rightmost) command to # exit with a non-zero status, or zero if all commands in the pipeline exit # successfully. set -o pipefail # Set IFS to just newline and tab at the start DEFAULT_IFS="${IFS}" SAFER_IFS=$'\n\t' IFS="${SAFER_IFS}" ############################################################################### # Environment ############################################################################### # $_ME # # Set to the program's basename. _ME=$(basename "${0}") ############################################################################### # Help ############################################################################### # _print_help() # # Usage: # _print_help # # Print the program help information. _print_help() { cat <] [] # # Description: # Entry point for the program, handling basic option parsing and dispatching. _main() { # No arguments provided if [[ $# -eq 0 ]] ; then _print_help fi # Avoid complex option parsing when only one program option is expected. if [[ "${1:-}" =~ ^-h|--help$ ]] then _print_help else _mainflux_docker "$@" fi } # Call `_main` after everything has been defined. _main "$@"