From a56cafdacd7e77c1f65ae50205a8fee24baa3507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chastanet?= Date: Mon, 23 Sep 2024 00:23:18 +0200 Subject: [PATCH 1/2] recompiled binaries using go-compiler and btf updates - sort definition files by priority (string -> int) - Version::checkMinimal success message if same version --- bin/cli | 43 +++++++++++++++++++++++++++++--------- bin/dbImport | 43 +++++++++++++++++++++++++++++--------- bin/dbImportProfile | 43 +++++++++++++++++++++++++++++--------- bin/dbImportStream | 43 +++++++++++++++++++++++++++++--------- bin/dbQueryAllDatabases | 43 +++++++++++++++++++++++++++++--------- bin/dbScriptAllDatabases | 43 +++++++++++++++++++++++++++++--------- bin/doc | 2 -- bin/gitIsAncestorOf | 43 +++++++++++++++++++++++++++++--------- bin/gitIsBranch | 43 +++++++++++++++++++++++++++++--------- bin/gitRenameBranch | 43 +++++++++++++++++++++++++++++--------- bin/installRequirements | 2 -- bin/mysql2puml | 2 -- bin/postmanCli | 21 ++++++++++--------- bin/upgradeGithubRelease | 21 ++++++++++--------- bin/waitForIt | 43 +++++++++++++++++++++++++++++--------- bin/waitForMysql | 43 +++++++++++++++++++++++++++++--------- conf/dbScripts/extractData | 43 +++++++++++++++++++++++++++++--------- install | 2 -- 18 files changed, 418 insertions(+), 148 deletions(-) diff --git a/bin/cli b/bin/cli index b1aa1df..72c50b9 100755 --- a/bin/cli +++ b/bin/cli @@ -862,6 +862,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -958,6 +971,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1188,17 +1210,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1251,7 +1276,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2054,7 +2078,6 @@ cliCommandParse() { cliCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Easy connection to docker container." - echo echo diff --git a/bin/dbImport b/bin/dbImport index 8492dee..16dce0b 100755 --- a/bin/dbImport +++ b/bin/dbImport @@ -1092,6 +1092,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -1188,6 +1201,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1418,17 +1440,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1481,7 +1506,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2586,7 +2610,6 @@ dbImportCommandParse() { dbImportCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Import source db into target db using eventual table filter." - echo echo diff --git a/bin/dbImportProfile b/bin/dbImportProfile index 7aa5a39..fd7b958 100755 --- a/bin/dbImportProfile +++ b/bin/dbImportProfile @@ -971,6 +971,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -1067,6 +1080,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1297,17 +1319,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1360,7 +1385,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2281,7 +2305,6 @@ dbImportProfileCommandParse() { dbImportProfileCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Generate optimized profiles to be used by dbImport." - echo echo diff --git a/bin/dbImportStream b/bin/dbImportStream index 3783491..9dcfa32 100755 --- a/bin/dbImportStream +++ b/bin/dbImportStream @@ -999,6 +999,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -1095,6 +1108,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1325,17 +1347,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1388,7 +1413,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2351,7 +2375,6 @@ dbImportStreamCommandParse() { dbImportStreamCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Stream tar.gz file or gz file through mysql." - echo echo diff --git a/bin/dbQueryAllDatabases b/bin/dbQueryAllDatabases index 8c83cfb..ee53b35 100755 --- a/bin/dbQueryAllDatabases +++ b/bin/dbQueryAllDatabases @@ -1049,6 +1049,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -1145,6 +1158,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1375,17 +1397,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1438,7 +1463,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2358,7 +2382,6 @@ dbQueryAllDatabasesCommandParse() { dbQueryAllDatabasesCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Execute a query on multiple databases to generate a tsv format report." "The query can be parallelized on multiple databases." - echo echo diff --git a/bin/dbScriptAllDatabases b/bin/dbScriptAllDatabases index b13433d..455f0dd 100755 --- a/bin/dbScriptAllDatabases +++ b/bin/dbScriptAllDatabases @@ -951,6 +951,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -1047,6 +1060,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1277,17 +1299,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1340,7 +1365,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2318,7 +2342,6 @@ dbScriptAllDatabasesCommandParse() { dbScriptAllDatabasesCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Allows to execute a script on each database of specified mysql server." "" - echo echo diff --git a/bin/doc b/bin/doc index 7da3dec..46c52e8 100755 --- a/bin/doc +++ b/bin/doc @@ -1216,7 +1216,6 @@ UI::theme() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1865,7 +1864,6 @@ docCommandParse() { docCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Generate markdown documentation." - echo echo diff --git a/bin/gitIsAncestorOf b/bin/gitIsAncestorOf index c935a28..51361e5 100755 --- a/bin/gitIsAncestorOf +++ b/bin/gitIsAncestorOf @@ -632,6 +632,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using error color (red) and exit immediately with error status 1 # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -715,6 +728,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description activate or not Log::display* and Log::log* functions # based on BASH_FRAMEWORK_DISPLAY_LEVEL and BASH_FRAMEWORK_LOG_LEVEL # environment variables loaded by Env::requireLoad @@ -936,17 +958,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -999,7 +1024,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1734,7 +1758,6 @@ gitIsAncestorOfCommandParse() { gitIsAncestorOfCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "check if ref is inside a given branch." - echo echo diff --git a/bin/gitIsBranch b/bin/gitIsBranch index 6a4bfa3..e05a853 100755 --- a/bin/gitIsBranch +++ b/bin/gitIsBranch @@ -632,6 +632,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using error color (red) and exit immediately with error status 1 # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -715,6 +728,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description activate or not Log::display* and Log::log* functions # based on BASH_FRAMEWORK_DISPLAY_LEVEL and BASH_FRAMEWORK_LOG_LEVEL # environment variables loaded by Env::requireLoad @@ -936,17 +958,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -999,7 +1024,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1709,7 +1733,6 @@ gitIsBranchCommandParse() { gitIsBranchCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Show an error if branchName is not a known branch." - echo echo diff --git a/bin/gitRenameBranch b/bin/gitRenameBranch index 5ac6701..74d6696 100755 --- a/bin/gitRenameBranch +++ b/bin/gitRenameBranch @@ -632,6 +632,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using error color (red) and exit immediately with error status 1 # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -715,6 +728,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description activate or not Log::display* and Log::log* functions # based on BASH_FRAMEWORK_DISPLAY_LEVEL and BASH_FRAMEWORK_LOG_LEVEL # environment variables loaded by Env::requireLoad @@ -959,17 +981,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1022,7 +1047,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1834,7 +1858,6 @@ gitRenameBranchCommandParse() { gitRenameBranchCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Rename git local branch, push new branch and delete old branch." - echo echo diff --git a/bin/installRequirements b/bin/installRequirements index 5673248..54fd60e 100755 --- a/bin/installRequirements +++ b/bin/installRequirements @@ -959,7 +959,6 @@ UI::theme() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1588,7 +1587,6 @@ installRequirementsCommandParse() { installRequirementsCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Installs requirements." - echo echo diff --git a/bin/mysql2puml b/bin/mysql2puml index 4fe8045..0e00242 100755 --- a/bin/mysql2puml +++ b/bin/mysql2puml @@ -1068,7 +1068,6 @@ UI::theme() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1799,7 +1798,6 @@ mysql2pumlCommandParse() { mysql2pumlCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Converts mysql dump sql schema to plantuml format." - echo echo diff --git a/bin/postmanCli b/bin/postmanCli index 44ecf2e..b907404 100755 --- a/bin/postmanCli +++ b/bin/postmanCli @@ -1535,17 +1535,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1598,7 +1601,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2357,7 +2359,6 @@ postmanCliCommandParse() { postmanCliCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Push/Pull postman collections of all the configured repositories." - echo echo diff --git a/bin/upgradeGithubRelease b/bin/upgradeGithubRelease index 28f6a28..23f66b4 100755 --- a/bin/upgradeGithubRelease +++ b/bin/upgradeGithubRelease @@ -1145,17 +1145,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1316,7 +1319,6 @@ Web::upgradeRelease() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -2182,7 +2184,6 @@ upgradeGithubReleaseCommandParse() { upgradeGithubReleaseCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Retrieve latest binary release from github and install it." - echo echo diff --git a/bin/waitForIt b/bin/waitForIt index e832ee7..b9ea61a 100755 --- a/bin/waitForIt +++ b/bin/waitForIt @@ -639,6 +639,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using error color (red) and exit immediately with error status 1 # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -722,6 +735,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description activate or not Log::display* and Log::log* functions # based on BASH_FRAMEWORK_DISPLAY_LEVEL and BASH_FRAMEWORK_LOG_LEVEL # environment variables loaded by Env::requireLoad @@ -943,17 +965,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1006,7 +1031,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1882,7 +1906,6 @@ waitForItCommandParse() { waitForItCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Wait for host:port to be available." - echo echo diff --git a/bin/waitForMysql b/bin/waitForMysql index d271b2a..f309760 100755 --- a/bin/waitForMysql +++ b/bin/waitForMysql @@ -622,6 +622,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using error color (red) and exit immediately with error status 1 # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -705,6 +718,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description activate or not Log::display* and Log::log* functions # based on BASH_FRAMEWORK_DISPLAY_LEVEL and BASH_FRAMEWORK_LOG_LEVEL # environment variables loaded by Env::requireLoad @@ -926,17 +948,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -989,7 +1014,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1832,7 +1856,6 @@ waitForMysqlCommandParse() { waitForMysqlCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Wait for mysql to be ready." - echo echo diff --git a/conf/dbScripts/extractData b/conf/dbScripts/extractData index 6dff982..dbb4841 100755 --- a/conf/dbScripts/extractData +++ b/conf/dbScripts/extractData @@ -888,6 +888,19 @@ Log::displayInfo() { } +# @description Display message using success color (bg green/fg white) +# @arg $1 message:String the message to display +# @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs +# @env LOG_CONTEXT String allows to contextualize the log +Log::displaySuccess() { + if ((BASH_FRAMEWORK_DISPLAY_LEVEL >= __LEVEL_INFO)); then + Log::computeDuration + echo -e "${__SUCCESS_COLOR}SUCCESS - ${LOG_CONTEXT:-}${LOG_LAST_DURATION_STR:-}${1}${__RESET_COLOR}" >&2 + fi + Log::logSuccess "$1" +} + + # @description Display message using warning color (yellow) # @arg $1 message:String the message to display # @env DISPLAY_DURATION int (default 0) if 1 display elapsed time information between 2 info logs @@ -984,6 +997,15 @@ Log::logMessage() { } +# @description log message to file +# @arg $1 message:String the message to display +Log::logSuccess() { + if ((BASH_FRAMEWORK_LOG_LEVEL >= __LEVEL_INFO)); then + Log::logMessage "${2:-SUCCESS}" "$1" + fi +} + + # @description log message to file # @arg $1 message:String the message to display Log::logWarning() { @@ -1214,17 +1236,20 @@ Version::checkMinimal() { Log::displayDebug "check ${commandName} version ${version} against minimal ${minimalVersion}" - Version::compare "${version}" "${minimalVersion}" || { - local result=$? - if [[ "${result}" = "1" ]]; then + local result=0 + Version::compare "${version}" "${minimalVersion}" || result=$? + case "${result}" in + 1) Log::displayInfo "${commandName} version is ${version} greater than ${minimalVersion}" - elif [[ "${result}" = "2" ]]; then + ;; + 2) Log::displayError "${commandName} minimal version is ${minimalVersion}, your version is ${version}" return 1 - fi - return 0 - } - + ;; + *) + Log::displaySuccess "${commandName} version is matching exactly the expected minimal version ${version}" + ;; + esac } @@ -1277,7 +1302,6 @@ Version::parse() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1957,7 +1981,6 @@ extractDataCommandParse() { extractDataCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "" - echo echo diff --git a/install b/install index 653a066..3dd1f46 100755 --- a/install +++ b/install @@ -938,7 +938,6 @@ UI::theme() { } # FUNCTIONS - declare -a BASH_FRAMEWORK_ARGV_FILTERED=() beforeParseCallback() { @@ -1591,7 +1590,6 @@ installCommandParse() { installCommandHelp() { echo -e "${__HELP_TITLE_COLOR}SYNOPSIS:${__RESET_COLOR}" Array::wrap2 ' ' 76 4 " " "Installs bash-tools." - echo echo From a5a12e95f0806203bdb9fab8f92d027ccf7cb18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chastanet?= Date: Sat, 28 Sep 2024 17:15:31 +0200 Subject: [PATCH 2/2] using bash-compiler v1.1.0 - fixed log file path using BASH_TOOLS_ROOT_DIR base path --- .framework-config | 2 +- .pre-commit-config-github.yaml | 4 ++-- .pre-commit-config.yaml | 4 ++-- bin/cli | 8 +++++++- bin/dbImport | 6 +++++- bin/dbImportProfile | 4 +++- bin/dbImportStream | 6 +++++- bin/dbQueryAllDatabases | 4 +++- bin/dbScriptAllDatabases | 5 ++++- bin/doc | 2 +- bin/gitIsAncestorOf | 6 +++++- bin/gitIsBranch | 4 +++- bin/gitRenameBranch | 6 +++++- bin/installRequirements | 2 +- bin/mysql2puml | 4 +++- bin/postmanCli | 5 ++++- bin/upgradeGithubRelease | 6 +++++- bin/waitForIt | 7 ++++++- bin/waitForMysql | 11 ++++++++++- conf/dbScripts/extractData | 2 +- conf/defaultEnv/.env | 2 +- install | 4 ++-- src/_binaries/build/install/install-main.sh | 2 +- 23 files changed, 80 insertions(+), 26 deletions(-) diff --git a/.framework-config b/.framework-config index f89ee4d..74be301 100755 --- a/.framework-config +++ b/.framework-config @@ -50,7 +50,7 @@ SRC_FILE_PATH="${CURRENT_COMPILED_RELATIVE_FILE#/}" BASH_FRAMEWORK_THEME="${BASH_FRAMEWORK_THEME:-default}" BASH_FRAMEWORK_LOG_LEVEL="${BASH_FRAMEWORK_LOG_LEVEL:-0}" BASH_FRAMEWORK_DISPLAY_LEVEL="${BASH_FRAMEWORK_DISPLAY_LEVEL:-3}" -BASH_FRAMEWORK_LOG_FILE="${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/${0##*/}.log}" +BASH_FRAMEWORK_LOG_FILE="${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/${0##*/}.log}" BASH_FRAMEWORK_LOG_FILE_MAX_ROTATION="${BASH_FRAMEWORK_LOG_FILE_MAX_ROTATION:-5}" # display elapsed time since last log diff --git a/.pre-commit-config-github.yaml b/.pre-commit-config-github.yaml index 22c1ff7..766b737 100644 --- a/.pre-commit-config-github.yaml +++ b/.pre-commit-config-github.yaml @@ -94,7 +94,7 @@ repos: )$ - repo: https://github.com/rhysd/actionlint - rev: v1.7.1 + rev: v1.7.2 hooks: - id: actionlint stages: [pre-commit, pre-push, manual] @@ -210,6 +210,6 @@ repos: stages: [manual] # GITHUB - repo: https://github.com/fchastanet/bash-compiler - rev: v1.0.0 + rev: v1.1.0 hooks: - id: buildBashBinaries diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93ae6e5..a2dd9b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -89,7 +89,7 @@ repos: )$ - repo: https://github.com/rhysd/actionlint - rev: v1.7.1 + rev: v1.7.2 hooks: - id: actionlint stages: [pre-commit, pre-push, manual] @@ -205,6 +205,6 @@ repos: stages: [] # GITHUB - repo: https://github.com/fchastanet/bash-compiler - rev: v1.0.0 + rev: v1.1.0 hooks: - id: buildBashBinaries diff --git a/bin/cli b/bin/cli index 72c50b9..39ab66f 100755 --- a/bin/cli +++ b/bin/cli @@ -385,7 +385,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1714,14 +1714,17 @@ cliCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true containerArg="" + local -i options_parse_argParsedCountContainerArg ((options_parse_argParsedCountContainerArg = 0)) || true userArg="" + local -i options_parse_argParsedCountUserArg ((options_parse_argParsedCountUserArg = 0)) || true commandArg="" + local -i options_parse_argParsedCountCommandArg ((options_parse_argParsedCountCommandArg = 0)) || true @@ -2105,14 +2108,17 @@ cliCommandHelp() { containerArgHelpFunction + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}user${__HELP_NORMAL} {single}]" userArgHelpFunction + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}command${__HELP_NORMAL} {single}]" commandArgHelpFunction + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/dbImport b/bin/dbImport index 16dce0b..ea6293c 100755 --- a/bin/dbImport +++ b/bin/dbImport @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -2083,10 +2083,12 @@ dbImportCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true fromDbName="" + local -i options_parse_argParsedCountFromDbName ((options_parse_argParsedCountFromDbName = 0)) || true targetDbName="" + local -i options_parse_argParsedCountTargetDbName ((options_parse_argParsedCountTargetDbName = 0)) || true @@ -2637,10 +2639,12 @@ dbImportCommandHelp() { Array::wrap2 ' ' 76 4 " " "The name of the source/remote database." echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}${__HELP_NORMAL} {single}]" Array::wrap2 ' ' 76 4 " " "The name of the target database" "Default value: (without extension)" "" echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/dbImportProfile b/bin/dbImportProfile index fd7b958..4403d41 100755 --- a/bin/dbImportProfile +++ b/bin/dbImportProfile @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1894,6 +1894,7 @@ dbImportProfileCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true fromDbName="" + local -i options_parse_argParsedCountFromDbName ((options_parse_argParsedCountFromDbName = 0)) || true @@ -2332,6 +2333,7 @@ dbImportProfileCommandHelp() { Array::wrap2 ' ' 76 4 " " "The name of the source/remote database." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/dbImportStream b/bin/dbImportStream index 9dcfa32..11a28d0 100755 --- a/bin/dbImportStream +++ b/bin/dbImportStream @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1918,10 +1918,12 @@ dbImportStreamCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true argDumpFile="" + local -i options_parse_argParsedCountArgDumpFile ((options_parse_argParsedCountArgDumpFile = 0)) || true argTargetDbName="" + local -i options_parse_argParsedCountArgTargetDbName ((options_parse_argParsedCountArgTargetDbName = 0)) || true @@ -2402,10 +2404,12 @@ dbImportStreamCommandHelp() { Array::wrap2 ' ' 76 4 " " "The file that will be streamed through mysql." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}argTargetDbName${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "The name of the mysql target database." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/dbQueryAllDatabases b/bin/dbQueryAllDatabases index ee53b35..9f010dc 100755 --- a/bin/dbQueryAllDatabases +++ b/bin/dbQueryAllDatabases @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1948,6 +1948,7 @@ dbQueryAllDatabasesCommandParse() { ((options_parse_optionParsedCountOptionSeparator = 0)) || true argQuery="" + local -i options_parse_argParsedCountArgQuery ((options_parse_argParsedCountArgQuery = 0)) || true @@ -2409,6 +2410,7 @@ dbQueryAllDatabasesCommandHelp() { argQueryHelpFunction + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/dbScriptAllDatabases b/bin/dbScriptAllDatabases index 455f0dd..817fa98 100755 --- a/bin/dbScriptAllDatabases +++ b/bin/dbScriptAllDatabases @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1852,6 +1852,7 @@ dbScriptAllDatabasesCommandParse() { ((options_parse_optionParsedCountOptionLogFormat = 0)) || true argScriptToExecute="" + local -i options_parse_argParsedCountArgScriptToExecute ((options_parse_argParsedCountArgScriptToExecute = 0)) || true @@ -2369,10 +2370,12 @@ dbScriptAllDatabasesCommandHelp() { Array::wrap2 ' ' 76 4 " " "The script that will be executed on each databases." echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}scriptArguments${__HELP_NORMAL} {list} (optional)]" Array::wrap2 ' ' 76 4 " " "Optional parameters to pass to the script." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/doc b/bin/doc index 46c52e8..a4bed2f 100755 --- a/bin/doc +++ b/bin/doc @@ -340,7 +340,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level diff --git a/bin/gitIsAncestorOf b/bin/gitIsAncestorOf index 51361e5..5e7e6e1 100755 --- a/bin/gitIsAncestorOf +++ b/bin/gitIsAncestorOf @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1385,10 +1385,12 @@ gitIsAncestorOfCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true claimedBranchArg="" + local -i options_parse_argParsedCountClaimedBranchArg ((options_parse_argParsedCountClaimedBranchArg = 0)) || true refArg="" + local -i options_parse_argParsedCountRefArg ((options_parse_argParsedCountRefArg = 0)) || true @@ -1785,10 +1787,12 @@ gitIsAncestorOfCommandHelp() { Array::wrap2 ' ' 76 4 " " "The branch in which the ref will be searched." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}ref${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "The ref to check." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/gitIsBranch b/bin/gitIsBranch index e05a853..9fdac87 100755 --- a/bin/gitIsBranch +++ b/bin/gitIsBranch @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1384,6 +1384,7 @@ gitIsBranchCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true branchNameArg="" + local -i options_parse_argParsedCountBranchNameArg ((options_parse_argParsedCountBranchNameArg = 0)) || true @@ -1760,6 +1761,7 @@ gitIsBranchCommandHelp() { Array::wrap2 ' ' 76 4 " " "The branch name to check." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/gitRenameBranch b/bin/gitRenameBranch index 74d6696..d0eb25c 100755 --- a/bin/gitRenameBranch +++ b/bin/gitRenameBranch @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1443,10 +1443,12 @@ gitRenameBranchCommandParse() { ((options_parse_optionParsedCountOptionDelete = 0)) || true newBranchNameArg="" + local -i options_parse_argParsedCountNewBranchNameArg ((options_parse_argParsedCountNewBranchNameArg = 0)) || true oldBranchNameArg="" + local -i options_parse_argParsedCountOldBranchNameArg ((options_parse_argParsedCountOldBranchNameArg = 0)) || true @@ -1885,10 +1887,12 @@ gitRenameBranchCommandHelp() { Array::wrap2 ' ' 76 4 " " "The new branch name." echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}oldBranchName${__HELP_NORMAL} {single}]" Array::wrap2 ' ' 76 4 " " "The name of the old branch if not current one." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/installRequirements b/bin/installRequirements index 54fd60e..01fafa4 100755 --- a/bin/installRequirements +++ b/bin/installRequirements @@ -340,7 +340,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level diff --git a/bin/mysql2puml b/bin/mysql2puml index 0e00242..ec80d4b 100755 --- a/bin/mysql2puml +++ b/bin/mysql2puml @@ -357,7 +357,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1446,6 +1446,7 @@ mysql2pumlCommandParse() { ((options_parse_optionParsedCountOptionSkin = 0)) || true inputSqlFile="" + local -i options_parse_argParsedCountInputSqlFile ((options_parse_argParsedCountInputSqlFile = 0)) || true @@ -1825,6 +1826,7 @@ mysql2pumlCommandHelp() { Array::wrap2 ' ' 76 4 " " "Sql filepath to parse (read from stdin if not provided)." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/postmanCli b/bin/postmanCli index b907404..8c31f18 100755 --- a/bin/postmanCli +++ b/bin/postmanCli @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1995,6 +1995,7 @@ postmanCliCommandParse() { ((options_parse_optionParsedCountOptionPostmanModelConfig = 0)) || true argCommand="" + local -i options_parse_argParsedCountArgCommand ((options_parse_argParsedCountArgCommand = 0)) || true @@ -2392,10 +2393,12 @@ postmanCliCommandHelp() { Array::wrap2 ' ' 76 8 " - ${__OPTION_COLOR}push:${__RESET_COLOR} Push" echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}ref${__HELP_NORMAL} {list} (optional)]" commandArgsHelpFunction + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/upgradeGithubRelease b/bin/upgradeGithubRelease index 23f66b4..28ef8ed 100755 --- a/bin/upgradeGithubRelease +++ b/bin/upgradeGithubRelease @@ -413,7 +413,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1751,10 +1751,12 @@ upgradeGithubReleaseCommandParse() { ((options_parse_optionParsedCountOptionExactVersion = 0)) || true targetFileArg="" + local -i options_parse_argParsedCountTargetFileArg ((options_parse_argParsedCountTargetFileArg = 0)) || true githubUrlPatternArg="" + local -i options_parse_argParsedCountGithubUrlPatternArg ((options_parse_argParsedCountGithubUrlPatternArg = 0)) || true @@ -2211,10 +2213,12 @@ upgradeGithubReleaseCommandHelp() { Array::wrap2 ' ' 76 4 " " "The binary downloaded will be written to this file path. Ensure the path is writable." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}githubUrlPattern${__HELP_NORMAL} {single} (mandatory)" githubUrlPatternHelpFunction + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/waitForIt b/bin/waitForIt index b9ea61a..9f54fad 100755 --- a/bin/waitForIt +++ b/bin/waitForIt @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1449,10 +1449,12 @@ waitForItCommandParse() { ((options_parse_optionParsedCountOptionLegacy = 0)) || true hostOrIpArg="" + local -i options_parse_argParsedCountHostOrIpArg ((options_parse_argParsedCountHostOrIpArg = 0)) || true portArg="" + local -i options_parse_argParsedCountPortArg ((options_parse_argParsedCountPortArg = 0)) || true @@ -1933,14 +1935,17 @@ waitForItCommandHelp() { Array::wrap2 ' ' 76 4 " " "Host or IP under test." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}port${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "TCP port under test." echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}commandArgs${__HELP_NORMAL} {list} (optional)]" Array::wrap2 ' ' 76 4 " " "Execute command with args after the test finishes or exit with status code if no command provided." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/bin/waitForMysql b/bin/waitForMysql index f309760..01436e9 100755 --- a/bin/waitForMysql +++ b/bin/waitForMysql @@ -371,7 +371,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1390,18 +1390,22 @@ waitForMysqlCommandParse() { ((options_parse_optionParsedCountOptionQuiet = 0)) || true mysqlHostArg="" + local -i options_parse_argParsedCountMysqlHostArg ((options_parse_argParsedCountMysqlHostArg = 0)) || true mysqlPortArg="" + local -i options_parse_argParsedCountMysqlPortArg ((options_parse_argParsedCountMysqlPortArg = 0)) || true mysqlUserArg="" + local -i options_parse_argParsedCountMysqlUserArg ((options_parse_argParsedCountMysqlUserArg = 0)) || true mysqlPasswordArg="" + local -i options_parse_argParsedCountMysqlPasswordArg ((options_parse_argParsedCountMysqlPasswordArg = 0)) || true @@ -1883,22 +1887,27 @@ waitForMysqlCommandHelp() { Array::wrap2 ' ' 76 4 " " "Mysql host name." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}mysqlPort${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "Mysql port." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}mysqlUser${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "Mysql user name." echo + Array::wrap2 " " 80 2 " ${__HELP_OPTION_COLOR}mysqlPassword${__HELP_NORMAL} {single} (mandatory)" Array::wrap2 ' ' 76 4 " " "Mysql user password." echo + Array::wrap2 " " 80 2 " [${__HELP_OPTION_COLOR}commandArgs${__HELP_NORMAL} {list} (optional)]" Array::wrap2 ' ' 76 4 " " "Execute command with args after the test finishes or exit with status code if no command provided." echo + # ------------------------------------------ # options section # ------------------------------------------ diff --git a/conf/dbScripts/extractData b/conf/dbScripts/extractData index dbb4841..6b0dd9a 100755 --- a/conf/dbScripts/extractData +++ b/conf/dbScripts/extractData @@ -382,7 +382,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level diff --git a/conf/defaultEnv/.env b/conf/defaultEnv/.env index 63f8de0..d40b2b3 100755 --- a/conf/defaultEnv/.env +++ b/conf/defaultEnv/.env @@ -30,7 +30,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level diff --git a/install b/install index 3dd1f46..78b695c 100755 --- a/install +++ b/install @@ -388,7 +388,7 @@ DISPLAY_DURATION=${DISPLAY_DURATION:0} ### all log messages will be redirected to log file specified ### this same path will be used inside and outside of the container ### -BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/bash.log} +BASH_FRAMEWORK_LOG_FILE=${BASH_FRAMEWORK_LOG_FILE:-${BASH_TOOLS_ROOT_DIR}/logs/bash.log} ### ### LOG Level @@ -1776,7 +1776,7 @@ if [[ -d "${HOME}/.bash-tools" ]]; then if [[ "${optionSkipBackup}" = "1" ]]; then Log::displayInfo "Backup of ~/.bash-tools is set to be skipped" else - BACKUP_DIR="${FRAMEWORK_ROOT_DIR}/logs" \ + BACKUP_DIR="${BASH_TOOLS_ROOT_DIR}/logs" \ Backup::dir "${HOME}" ".bash-tools" fi diff --git a/src/_binaries/build/install/install-main.sh b/src/_binaries/build/install/install-main.sh index 08efb1e..f10aec6 100755 --- a/src/_binaries/build/install/install-main.sh +++ b/src/_binaries/build/install/install-main.sh @@ -19,7 +19,7 @@ if [[ -d "${HOME}/.bash-tools" ]]; then if [[ "${optionSkipBackup}" = "1" ]]; then Log::displayInfo "Backup of ~/.bash-tools is set to be skipped" else - BACKUP_DIR="${FRAMEWORK_ROOT_DIR}/logs" \ + BACKUP_DIR="${BASH_TOOLS_ROOT_DIR}/logs" \ Backup::dir "${HOME}" ".bash-tools" fi