🚼 Bash Buddy(aka. BaBy) contains bash libs and tools that extracted from CI scripts of my open-source projects.
a common lib to show trapped error info including stack trace.
provide function trap_error_info::register_show_error_info_handler
to register the error-trap handler which show error info when trapped error.
by default, auto call trap_error_info::register_show_error_info_handler when source this script; disable by
define TRAP_ERROR_NO_AUTO_REGISTER var.
api functions:
trap_error_info::get_stack_tracetrap_error_info::register_show_error_info_handler
common util functions.
use short namespace cu, since these functions will be used frequently.
api functions:
- simple color print functions:
cu::red_echocu::yellow_echocu::blue_echocu::head_line_echo
- validation functions:
cu::is_number_stringcu::is_blank_string
- version related functions:
cu::version_lecu::version_ltcu::version_gecu::version_gtcu::is_version_matchcu::get_latest_version_matchcu::get_oldest_version_match
- execution helper functions:
cu::log_then_runcu::loose_runcu::print_calling_command_linecu::die
java util functions.
api functions:
jvu::get_java_versionjvu::switch_to_jdkjvu::java_cmd
maven util functions for build.
api functions:
- maven operation functions:
mvu::mvn_cmd
a lib to prepare jdks by sdkman.
api functions:
prepare_jdks::switch_to_jdkprepare_jdks::prepare_jdksprepare_jdks::install_jdk_by_sdkmanprepare_jdks::load_sdkmanprepare_jdks::install_sdkman
Generate source guard to bash lib scripts.
Example:
$ gen_source_guard
#_ source guard begin _#
[ -n "${source_guard_0EDD6400_96EC_43E4_871A_E65F6781B828:+has_value}" ] && return
source_guard_0EDD6400_96EC_43E4_871A_E65F6781B828=$(realpath -- "${BASH_SOURCE[0]}")
# the value of source guard is the canonical dir path of this script
readonly source_guard_0EDD6400_96EC_43E4_871A_E65F6781B828=${source_guard_0EDD6400_96EC_43E4_871A_E65F6781B828%/*}
#_ source guard end _#