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] 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