Skip to content

Commit

Permalink
binaries - fixed colors were replaced during compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Dec 5, 2023
1 parent c70391e commit 5b37261
Show file tree
Hide file tree
Showing 25 changed files with 216 additions and 176 deletions.
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ repos:
(?x)(
.svg$
)
- id: trailing-whitespace
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-xml
- id: check-yaml
- id: check-added-large-files
- id: forbid-new-submodules
- id: mixed-line-ending
args: [--fix=lf]
Expand All @@ -35,6 +37,11 @@ repos:
.vscode\/launch.json
)$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

- repo: https://github.com/fchastanet/jumanjihouse-pre-commit-hooks
rev: 3.0.2
hooks:
Expand All @@ -55,11 +62,6 @@ repos:
- id: git-check
exclude: /testsData/

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

- repo: https://github.com/fchastanet/bash-tools-framework
rev: 2.0.1
hooks:
Expand Down
4 changes: 2 additions & 2 deletions bin/dbQueryAllDatabases

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/dbScriptAllDatabases

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions bin/doc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Array::wrap() {
# @env GROUP_ID
# @env FRAMEWORK_ROOT_DIR
# @env DOCKER_OPTION_IMAGE_TAG
# @env BASH_FRAMEWORK_ARGV_FILTERED
# @env RUN_CONTAINER_ARGV_FILTERED
Docker::runBuildContainer() {
local optionVendor="$1"
local optionBashVersion="$2"
Expand Down Expand Up @@ -293,7 +293,7 @@ Docker::runBuildContainer() {

Log::displayDebug "Run container with localDockerRunCmd: ${localDockerRunCmd[*]}"
Log::displayDebug "Run container with localDockerRunArgs: ${localDockerRunArgs[*]}"
Log::displayDebug "Run container with BASH_FRAMEWORK_ARGV_FILTERED: ${BASH_FRAMEWORK_ARGV_FILTERED[*]}"
Log::displayDebug "Run container with RUN_CONTAINER_ARGV_FILTERED: ${RUN_CONTAINER_ARGV_FILTERED[*]}"
(
# shellcheck disable=SC2154
if [[ "${optionTraceVerbose}" = "1" ]]; then
Expand All @@ -304,6 +304,7 @@ Docker::runBuildContainer() {
--rm \
"${localDockerRunArgs[@]}" \
${DOCKER_RUN_OPTIONS} \
"${RUN_CONTAINER_ARGV_FILTERED[@]}" \
-w /bash \
-v "$(pwd):/bash" \
--user "${USER_ID:-$(id -u)}:${GROUP_ID:-$(id -g)}" \
Expand Down
20 changes: 18 additions & 2 deletions bin/installRequirements
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ cleanOnExit() {
}
trap cleanOnExit EXIT HUP QUIT ABRT TERM

# @description concat each element of an array with a separator
#
# @arg $1 glue:String
# @arg $@ array:String[]
# @example
# declare -a array=(test1, test2)
# echo "Result= $(Array::join "," "${array[@]})"
# Result= test1,test2
Array::join() {
local glue="${1-}"
shift || true
local first="${1-}"
shift || true
printf %s "${first}" "${@/#/${glue}}"
}

# @description concat each element of an array with a separator
# but wrapping text when line length is more than provided argument
# The algorithm will try not to cut the array element if can
Expand Down Expand Up @@ -1342,10 +1358,10 @@ installRequirementsCommand() {
helpArray=(set\ display\ level\ \(one\ of\ OFF\,\ ERROR\,\ WARNING\,\ INFO\,\ DEBUG\,\ TRACE\ value\))
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e """
[1;37mINSTALLS REQUIREMENTS:[0m
${__HELP_TITLE}INSTALLS REQUIREMENTS:${__HELP_NORMAL}
- fchastanet/bash-tools-framework
- and fchastanet/bash-tools-framework useful binaries:
bin/test"""
$(Array::join ", " "${externalBinaries[@]}")"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
echo '1.0'
Expand Down
19 changes: 13 additions & 6 deletions bin/mysql2puml
Original file line number Diff line number Diff line change
Expand Up @@ -1499,12 +1499,19 @@ mysql2pumlCommand() {
helpArray=(set\ display\ level\ \(one\ of\ OFF\,\ ERROR\,\ WARNING\,\ INFO\,\ DEBUG\,\ TRACE\ value\))
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e """
Examples
mysql2puml dump.dql
mysqldump --skip-add-drop-table --skip-add-locks --skip-disable-keys --skip-set-charset --user=root --password=root --no-data skills | mysql2puml
List of available skins:
${__HELP_TITLE}EXAMPLE 1:${__HELP_NORMAL}
${__HELP_EXAMPLE}mysql2puml dump.dql${__HELP_NORMAL}
${__HELP_TITLE}EXAMPLE 2:${__HELP_NORMAL}
${__HELP_EXAMPLE}mysqldump --skip-add-drop-table \
--skip-add-locks \
--skip-disable-keys \
--skip-set-charset \
--user=root \
--password=root \
--no-data skills | mysql2puml
${__HELP_NORMAL}
${__HELP_TITLE}LIST OF AVAILABLE SKINS:${__HELP_NORMAL}
@@@SKINS_LIST@@@"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
Expand Down
55 changes: 29 additions & 26 deletions bin/upgradeGithubRelease
Original file line number Diff line number Diff line change
Expand Up @@ -1623,23 +1623,23 @@ upgradeGithubReleaseCommand() {
echo -e " ${__HELP_OPTION_COLOR}--version-arg <versionArg>${__HELP_NORMAL} {single}"
local -a helpArray
# shellcheck disable=SC2054
helpArray=($'The argument that will be provided to the currently installed binary to check the version of the software. \n This parameter is needed if \E[2;97m--minimal-version\E[0m argument is used and is different than default value (\E[2;97m--version\E[0m).')
helpArray=($'The argument that will be provided to the currently installed binary\nto check the version of the software. See options constraints below.')
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo ' Default value: --version'
echo -e " ${__HELP_OPTION_COLOR}--current-version${__HELP_NORMAL}, ${__HELP_OPTION_COLOR}-c <currentVersion>${__HELP_NORMAL} {single}"
local -a helpArray
# shellcheck disable=SC2054
helpArray=($'Sometimes the command to retrieve the version is complicated. \n Some command needs you to parse json or other commands provides multiple sub command versions. In this case you can provide the version you currently have, see examples below.')
helpArray=($'Sometimes the command to retrieve the version is complicated.\nSome command needs you to parse json or other commands provides\nmultiple sub command versions. In this case you can provide the\nversion you currently have, see examples below.\nSee options constraints below.')
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e " ${__HELP_OPTION_COLOR}--exact-version${__HELP_NORMAL}, ${__HELP_OPTION_COLOR}-e <exactVersion>${__HELP_NORMAL} {single}"
local -a helpArray
# shellcheck disable=SC2054
helpArray=($'if provided and currently installed binary is not this \E[2;97mexactVersion\E[0m, \n This exact version of the binary will be installed.')
helpArray=($'if provided and currently installed binary is not this [2;97mexactVersion[0m,\n This exact version of the binary will be installed.\n See options constraints below.')
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e " ${__HELP_OPTION_COLOR}--minimal-version${__HELP_NORMAL}, ${__HELP_OPTION_COLOR}-m <minimalVersion>${__HELP_NORMAL} {single}"
local -a helpArray
# shellcheck disable=SC2054
helpArray=($'if provided and currently installed binary is below this \E[2;97mminimalVersion\E[0m, \n a new version of the binary will be installed. \n If this argument is not provided, the latest binary is unconditionally downloaded from github.')
helpArray=($'if provided and currently installed binary is below this [2;97mminimalVersion[0m,\na new version of the binary will be installed.\nIf this argument is not provided, the latest binary is unconditionally downloaded from github.\nSee options constraints below.')
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo
echo -e "${__HELP_TITLE_COLOR}GLOBAL OPTIONS:${__RESET_COLOR}"
Expand Down Expand Up @@ -1714,40 +1714,43 @@ upgradeGithubReleaseCommand() {
helpArray=(set\ display\ level\ \(one\ of\ OFF\,\ ERROR\,\ WARNING\,\ INFO\,\ DEBUG\,\ TRACE\ value\))
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e """
[1;37mOPTIONS EXCEPTIONS:[0m
${__HELP_TITLE}OPTIONS CONSTRAINTS:${__HELP_NORMAL}
--current-version|-c and --version-arg are mutually exclusive,
you cannot use both argument at the same time.
${__HELP_OPTION_COLOR}--version-arg${__HELP_NORMAL} parameter is needed if ${__HELP_OPTION_COLOR}--minimal-version${__HELP_NORMAL} argument is used and is different than default value.
--exact-version|-e and --minimal-version|-m are mutually exclusive,
you cannot use both argument at the same time.
${__HELP_OPTION_COLOR}--current-version${__HELP_NORMAL}|${__HELP_OPTION_COLOR}-c${__HELP_NORMAL} and ${__HELP_OPTION_COLOR}--version-arg${__HELP_NORMAL} are mutually exclusive, you cannot use both argument at the same time.
[1;37mGITHUB TEMPLATE URLS EXAMPLES:[0m
${__HELP_OPTION_COLOR}--exact-version${__HELP_NORMAL}|${__HELP_OPTION_COLOR}-e${__HELP_NORMAL} and ${__HELP_OPTION_COLOR}--minimal-version${__HELP_NORMAL}|${__HELP_OPTION_COLOR}-m${__HELP_NORMAL} are mutually exclusive, you cannot use both argument at the same time.
Simple ones(Sometimes @version@ template variable has to be specified twice):
'https://github.com/hadolint/hadolint/releases/download/v@version@/hadolint-Linux-x86_64'
'https://github.com/koalaman/shellcheck/releases/download/v@version@/shellcheck-v@[email protected]_64.tar.xz'
'https://github.com/sharkdp/fd/releases/download/v@version@/fd_@version@_amd64.deb'
'https://github.com/sharkdp/bat/releases/download/v@version@/bat_@version@_amd64.deb'
'https://github.com/kubernetes-sigs/kind/releases/download/v@version@/kind-linux-amd64'
'https://github.com/kubernetes/minikube/releases/download/v@version@/minikube-linux-amd64'
'https://github.com/plantuml/plantuml/releases/download/v@version@/plantuml-@[email protected]'
'https://github.com/Versent/saml2aws/releases/download/v@version@/saml2aws_@version@_linux_amd64.tar.gz'
${__HELP_TITLE}GITHUB TEMPLATE URLS EXAMPLES:${__HELP_NORMAL}
If you want to add a condition on architecture(linux, windows, x86, 64/32 bits):
\"https://github.com/docker/compose/releases/download/v@version@/docker-compose-\$(uname -s | tr '[:upper:]' '[:lower:]')-\$(uname -m)\"
Simple ones(Sometimes @version@ template variable has to be specified twice):${__HELP_EXAMPLE}
\"https://github.com/hadolint/hadolint/releases/download/v@version@/hadolint-Linux-x86_64\"
\"https://github.com/koalaman/shellcheck/releases/download/v@version@/shellcheck-v@[email protected]_64.tar.xz\"
\"https://github.com/sharkdp/fd/releases/download/v@version@/fd_@version@_amd64.deb\"
\"https://github.com/sharkdp/bat/releases/download/v@version@/bat_@version@_amd64.deb\"
\"https://github.com/kubernetes-sigs/kind/releases/download/v@version@/kind-linux-amd64\"
\"https://github.com/kubernetes/minikube/releases/download/v@version@/minikube-linux-amd64\"
\"https://github.com/plantuml/plantuml/releases/download/v@version@/plantuml-@[email protected]\"
\"https://github.com/Versent/saml2aws/releases/download/v@version@/saml2aws_@version@_linux_amd64.tar.gz\"
${__HELP_NORMAL}
If you want to add a condition on architecture(linux, windows, x86, 64/32 bits):${__HELP_EXAMPLE}
\"https://github.com/docker/compose/releases/download/v@version@/docker-compose-\$(uname -s | tr \"[:upper:]\" \"[:lower:]\")-\$(uname -m)\"
\"https://github.com/docker/docker-credential-helpers/releases/download/v@version@/docker-credential-wincred-v@[email protected]\$(dpkg --print-architecture).exe\"
\"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-\$(uname -s)-\$(uname -m)\"
[1;37mCOMMAND EXAMPLES:[0m
${__HELP_NORMAL}
${__HELP_TITLE}COMMAND EXAMPLES:${__HELP_NORMAL}
Download docker-compose latest version
upgradeGithubRelease /usr/local/bin/docker-compose \"https://github.com/docker/compose/releases/download/v@version@/docker-compose-\$(uname -s | tr '[:upper:]' '[:lower:]')-\$(uname -m)\"
${__HELP_EXAMPLE}upgradeGithubRelease /usr/local/bin/docker-compose \\
\"https://github.com/docker/compose/releases/download/v@version@/docker-compose-\$(uname -s | tr \"[:upper:]\" \"[:lower:]\")-\$(uname -m)\"${__HELP_NORMAL}
Download oq specific version
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 \"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-\$(uname -s)-\$(uname -m)\"
${__HELP_EXAMPLE}upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 \\
\"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-\$(uname -s)-\$(uname -m)\"${__HELP_NORMAL}
Download oq specific version correctly retrieving the oq version and not the jq one
upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 --version-arg '-V | grep oq:' \"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-\$(uname -s)-\$(uname -m)\""""
${__HELP_EXAMPLE}upgradeGithubRelease /usr/local/bin/oq --exact-version 1.3.4 --version-arg '-V | grep oq:' \\
\"https://github.com/Blacksmoke16/oq/releases/download/v@version@/oq-v@version@-\$(uname -s)-\$(uname -m)\"${__HELP_NORMAL}"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
echo '2.0'
Expand Down
24 changes: 12 additions & 12 deletions bin/waitForIt
Original file line number Diff line number Diff line change
Expand Up @@ -1437,18 +1437,18 @@ waitForItCommand() {
helpArray=(set\ display\ level\ \(one\ of\ OFF\,\ ERROR\,\ WARNING\,\ INFO\,\ DEBUG\,\ TRACE\ value\))
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e """
[1;37mEXIT STATUS CODES:[0m
\e[1;34m0[0m: the host/port is available
\e[1;34m1[0m: indicates host/port is not available or argument error
\e[1;34m2[0m: timeout reached
[1;37mAVAILABLE ALGORITHMS:[0m
\e[1;34mtimeoutV1WithNc[0m: previous version of timeout command with --timeout option, base command nc
\e[1;34mtimeoutV2WithNc[0m: newer version of timeout command using timeout as argument, base command nc
\e[1;34mwhileLoopWithNc[0m: timeout command simulated using while loop, base command nc
\e[1;34mtimeoutV1WithTcp[0m: previous version of timeout command with --timeout option
\e[1;34mtimeoutV2WithTcp[0m: newer version of timeout command using timeout as argument
\e[1;34mwhileLoopWithTcp[0m: timeout command simulated using while loop, base command tcp"""
${__HELP_TITLE}EXIT STATUS CODES:${__HELP_NORMAL}
${__HELP_OPTION_COLOR}0${__HELP_NORMAL}: the host/port is available
${__HELP_OPTION_COLOR}1${__HELP_NORMAL}: indicates host/port is not available or argument error
${__HELP_OPTION_COLOR}2${__HELP_NORMAL}: timeout reached
${__HELP_TITLE}AVAILABLE ALGORITHMS:${__HELP_NORMAL}
${__HELP_OPTION_COLOR}timeoutV1WithNc${__HELP_NORMAL}: previous version of timeout command with --timeout option, base command nc
${__HELP_OPTION_COLOR}timeoutV2WithNc${__HELP_NORMAL}: newer version of timeout command using timeout as argument, base command nc
${__HELP_OPTION_COLOR}whileLoopWithNc${__HELP_NORMAL}: timeout command simulated using while loop, base command nc
${__HELP_OPTION_COLOR}timeoutV1WithTcp${__HELP_NORMAL}: previous version of timeout command with --timeout option
${__HELP_OPTION_COLOR}timeoutV2WithTcp${__HELP_NORMAL}: newer version of timeout command using timeout as argument
${__HELP_OPTION_COLOR}whileLoopWithTcp${__HELP_NORMAL}: timeout command simulated using while loop, base command tcp"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
echo '2.0'
Expand Down
8 changes: 4 additions & 4 deletions bin/waitForMysql
Original file line number Diff line number Diff line change
Expand Up @@ -1393,10 +1393,10 @@ waitForMysqlCommand() {
helpArray=(set\ display\ level\ \(one\ of\ OFF\,\ ERROR\,\ WARNING\,\ INFO\,\ DEBUG\,\ TRACE\ value\))
echo -e " $(Array::wrap " " 76 4 "${helpArray[@]}")"
echo -e """
[1;37mEXIT STATUS CODES:[0m
\e[1;34m0[0m: mysql is available
\e[1;34m1[0m: indicates mysql is not available or argument error
\e[1;34m2[0m: timeout reached"""
${__HELP_TITLE}EXIT STATUS CODES:${__HELP_NORMAL}
${__HELP_OPTION_COLOR}0${__HELP_NORMAL}: mysql is available
${__HELP_OPTION_COLOR}1${__HELP_NORMAL}: indicates mysql is not available or argument error
${__HELP_OPTION_COLOR}2${__HELP_NORMAL}: timeout reached"""
echo
echo -n -e "${__HELP_TITLE_COLOR}VERSION: ${__RESET_COLOR}"
echo '2.0'
Expand Down
Binary file added conf/mysql2pumlSkins/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions conf/mysql2pumlSkins/default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions src/_binaries/Converters/mysql2puml.options.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ declare versionNumber="1.0"
declare commandFunctionName="mysql2pumlCommand"
declare optionSkinDefault="default"
declare help="convert mysql dump sql schema to plantuml format"
declare longDescription="""
${__HELP_TITLE}Examples${__HELP_NORMAL}
mysql2puml dump.dql
# shellcheck disable=SC2016
declare longDescription='''
${__HELP_TITLE}EXAMPLE 1:${__HELP_NORMAL}
${__HELP_EXAMPLE}mysql2puml dump.dql${__HELP_NORMAL}

mysqldump --skip-add-drop-table \
${__HELP_TITLE}EXAMPLE 2:${__HELP_NORMAL}
${__HELP_EXAMPLE}mysqldump --skip-add-drop-table \
--skip-add-locks \
--skip-disable-keys \
--skip-set-charset \
--user=root \
--password=root \
--no-data skills | mysql2puml

${__HELP_TITLE}List of available skins:${__HELP_NORMAL}
@@@SKINS_LIST@@@"""
${__HELP_NORMAL}
${__HELP_TITLE}LIST OF AVAILABLE SKINS:${__HELP_NORMAL}
@@@SKINS_LIST@@@'''
%

.INCLUDE "$(dynamicTemplateDir _binaries/options/options.base.tpl)"
Expand Down
11 changes: 6 additions & 5 deletions src/_binaries/Converters/testsData/mysql2puml.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@
--display-level <String> {single}
set display level (one of OFF, ERROR, WARNING, INFO, DEBUG, TRACE value)

Examples
mysql2puml dump.dql
EXAMPLE 1:
mysql2puml dump.dql

mysqldump --skip-add-drop-table --skip-add-locks --skip-disable-keys --skip-set-charset --user=root --password=root --no-data skills | mysql2puml

List of available skins:
EXAMPLE 2:
mysqldump --skip-add-drop-table --skip-add-locks --skip-disable-keys --skip-set-charset --user=root --password=root --no-data skills | mysql2puml

LIST OF AVAILABLE SKINS:
- default

VERSION: 1.0
Expand Down
Binary file added src/_binaries/Converters/testsData/mysql2puml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/_binaries/Converters/testsData/mysql2puml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/_binaries/DbImport/dbImport.bats
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function Database::dbImport::remote_db_fully_functional_from_mysql { #@test
export BASH_FRAMEWORK_ENV_FILEPATH="${BATS_TEST_DIRNAME}/testsData/.env"

run "${binDir}/dbImport" --verbose -f default.local fromDb toDb 2>&1
unstub zcat
unstub_all
assert_output --partial "Import database duration : "
assert_output --partial "begin insert emptyTable"
assert_output --partial "begin insert dataTable"
Expand Down
Loading

0 comments on commit 5b37261

Please sign in to comment.