Skip to content

Latest commit

 

History

History
126 lines (90 loc) · 4.16 KB

README.md

File metadata and controls

126 lines (90 loc) · 4.16 KB

🚼 Bash Buddy

License GitHub release GitHub Stars GitHub Forks GitHub issues GitHub repo size

🚼 Bash Buddy(aka. BaBy) contains bash libs and tools that extracted from CI scripts of my open-source projects.



🗂 Lib

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_trace
  • trap_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_echo
    • cu::yellow_echo
    • cu::blue_echo
    • cu::head_line_echo
  • validation functions:
    • cu::is_number_string
    • cu::is_blank_string
  • version related functions:
    • cu::version_le
    • cu::version_lt
    • cu::version_ge
    • cu::version_gt
    • cu::is_version_match
    • cu::get_latest_version_match
    • cu::get_oldest_version_match
  • execution helper functions:
    • cu::log_then_run
    • cu::loose_run
    • cu::print_calling_command_line
    • cu::die

java util functions.

api functions:

  • jvu::get_java_version
  • jvu::switch_to_jdk
  • jvu::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_jdk
  • prepare_jdks::prepare_jdks
  • prepare_jdks::install_jdk_by_sdkman
  • prepare_jdks::load_sdkman
  • prepare_jdks::install_sdkman

⚒️ Tool

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 _#