Skip to content

Commit

Permalink
removed deprecated --env-file option
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Sep 8, 2024
1 parent b397697 commit d2d57ed
Show file tree
Hide file tree
Showing 21 changed files with 200 additions and 785 deletions.
68 changes: 15 additions & 53 deletions bin/awkLint
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ beforeParseCallback() {

copyrightCallback() {
#
# shellcheck disable=SC2155,SC2154,SC2250
echo "Copyright (c) 2022-now François Chastanet"
}

Expand Down Expand Up @@ -832,16 +833,6 @@ optionVersionCallback() {
exit 0
}

# shellcheck disable=SC2317 # if function is overridden
optionEnvFileCallback() {
local envFile="$2"
Log::displayWarning "Command ${SCRIPT_NAME} - Option --env-file is deprecated and will be removed in the future"
if [[ ! -f "${envFile}" || ! -r "${envFile}" ]]; then
Log::displayError "Command ${SCRIPT_NAME} - Option --env-file - File '${envFile}' doesn't exist"
exit 1
fi
}

# shellcheck disable=SC2317 # if function is overridden
optionInfoVerboseCallback() {
BASH_FRAMEWORK_ARGS_VERBOSE_OPTION='--verbose'
Expand Down Expand Up @@ -1016,9 +1007,6 @@ commandOptionParseFinished() {
defaultEnvFile="${PERSISTENT_TMPDIR}/.framework-config"
echo "${defaultFrameworkConfig}" >"${defaultEnvFile}"
local -a files=("${defaultEnvFile}")
if [[ -f "${envFile}" ]]; then
files+=("${envFile}")
fi
# shellcheck disable=SC2154
if [[ -f "${optionBashFrameworkConfig}" ]]; then
files+=("${optionBashFrameworkConfig}")
Expand Down Expand Up @@ -1051,7 +1039,6 @@ declare optionBashFrameworkConfig=""
declare optionInfoVerbose="0"
declare optionDebugVerbose="0"
declare optionTraceVerbose="0"
declare -a optionEnvFiles=()
declare optionLogLevel=""
declare optionLogFile=""
declare optionDisplayLevel=""
Expand Down Expand Up @@ -1082,7 +1069,6 @@ awkLintCommandParse() {
optionTraceVerbose="0"
local -i options_parse_optionParsedCountOptionTraceVerbose
((options_parse_optionParsedCountOptionTraceVerbose = 0)) || true

optionLogLevel=""
local -i options_parse_optionParsedCountOptionLogLevel
((options_parse_optionParsedCountOptionLogLevel = 0)) || true
Expand Down Expand Up @@ -1112,7 +1098,7 @@ awkLintCommandParse() {
local options_parse_arg="$1"
local argOptDefaultBehavior=0
case "${options_parse_arg}" in
# Option 1/14
# Option 1/13
# optionHelp alts --help|-h
# type: Boolean min 0 max 1
--help | -h)
Expand All @@ -1128,7 +1114,7 @@ awkLintCommandParse() {

;;

# Option 2/14
# Option 2/13
# optionConfig alts --config
# type: Boolean min 0 max 1
--config)
Expand All @@ -1142,7 +1128,7 @@ awkLintCommandParse() {
((++options_parse_optionParsedCountOptionConfig))
;;

# Option 3/14
# Option 3/13
# optionBashFrameworkConfig alts --bash-framework-config
# type: String min 0 max 1
--bash-framework-config)
Expand All @@ -1163,7 +1149,7 @@ awkLintCommandParse() {

;;

# Option 4/14
# Option 4/13
# optionInfoVerbose alts --verbose|-v
# type: Boolean min 0 max 1
--verbose | -v)
Expand All @@ -1181,7 +1167,7 @@ awkLintCommandParse() {

;;

# Option 5/14
# Option 5/13
# optionDebugVerbose alts -vv
# type: Boolean min 0 max 1
-vv)
Expand All @@ -1199,7 +1185,7 @@ awkLintCommandParse() {

;;

# Option 6/14
# Option 6/13
# optionTraceVerbose alts -vvv
# type: Boolean min 0 max 1
-vvv)
Expand All @@ -1217,25 +1203,7 @@ awkLintCommandParse() {

;;

# Option 7/14
# optionEnvFiles alts --env-file
# type: StringArray min 0 max -1
--env-file)
shift
if (($# == 0)); then
Log::displayError "Command ${SCRIPT_NAME} - Option ${options_parse_arg} - a value needs to be specified"
return 1
fi

((++options_parse_optionParsedCountOptionEnvFiles))
optionEnvFiles+=("$1")
optionEnvFileCallback "${options_parse_arg}" "${optionEnvFiles[@]}"

updateArgListEnvFileCallback "${options_parse_arg}" "${optionEnvFiles[@]}"

;;

# Option 8/14
# Option 7/13
# optionLogLevel alts --log-level
# type: String min 0 max 1
# authorizedValues: OFF|ERR|ERROR|WARN|WARNING|INFO|DEBUG|TRACE
Expand Down Expand Up @@ -1263,7 +1231,7 @@ awkLintCommandParse() {

;;

# Option 9/14
# Option 8/13
# optionLogFile alts --log-file
# type: String min 0 max 1
--log-file)
Expand All @@ -1286,7 +1254,7 @@ awkLintCommandParse() {

;;

# Option 10/14
# Option 9/13
# optionDisplayLevel alts --display-level
# type: String min 0 max 1
# authorizedValues: OFF|ERR|ERROR|WARN|WARNING|INFO|DEBUG|TRACE
Expand Down Expand Up @@ -1314,7 +1282,7 @@ awkLintCommandParse() {

;;

# Option 11/14
# Option 10/13
# optionNoColor alts --no-color
# type: Boolean min 0 max 1
--no-color)
Expand All @@ -1332,7 +1300,7 @@ awkLintCommandParse() {

;;

# Option 12/14
# Option 11/13
# optionTheme alts --theme
# type: String min 0 max 1
# authorizedValues: default|default-force|noColor
Expand Down Expand Up @@ -1360,7 +1328,7 @@ awkLintCommandParse() {

;;

# Option 13/14
# Option 12/13
# optionVersion alts --version
# type: Boolean min 0 max 1
--version)
Expand All @@ -1376,7 +1344,7 @@ awkLintCommandParse() {

;;

# Option 14/14
# Option 13/13
# optionQuiet alts --quiet|-q
# type: Boolean min 0 max 1
--quiet | -q)
Expand Down Expand Up @@ -1432,7 +1400,7 @@ awkLintCommandHelp() {
# ------------------------------------------
# usage/options section
# ------------------------------------------
optionsAltList=("[--help|-h]" "[--config]" "[--bash-framework-config <bash-framework-config>]" "[--verbose|-v]" "[-vv]" "[-vvv]" "[--env-file <env-file>]" "[--log-level <log-level>]" "[--log-file <log-file>]" "[--display-level <display-level>]" "[--no-color]" "[--theme <theme>]" "[--version]" "[--quiet|-q]"
optionsAltList=("[--help|-h]" "[--config]" "[--bash-framework-config <bash-framework-config>]" "[--verbose|-v]" "[-vv]" "[-vvv]" "[--log-level <log-level>]" "[--log-file <log-file>]" "[--display-level <display-level>]" "[--no-color]" "[--theme <theme>]" "[--version]" "[--quiet|-q]"
)
Array::wrap2 " " 80 2 "${__HELP_TITLE_COLOR}USAGE:${__RESET_COLOR}" \
"awkLint" "${optionsAltList[@]}"
Expand Down Expand Up @@ -1479,12 +1447,6 @@ awkLintCommandHelp() {



echo -e " ${__HELP_OPTION_COLOR}--env-file <env-file>${__HELP_NORMAL} {list} (optional)"
Array::wrap2 ' ' 76 4 " " "Load the specified env file (deprecated, please use --bash-framework-config option instead)"
echo



echo -e " ${__HELP_OPTION_COLOR}--log-level <log-level>${__HELP_NORMAL} {single}"
Array::wrap2 ' ' 76 4 " " "Set log level"
echo
Expand Down
Loading

0 comments on commit d2d57ed

Please sign in to comment.