-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Facade calls function on invalid action command's short/long description overridable by callback function tag: 2.3.2 # Breaking changes # Bug fixes - Ability to use a function to override command short/long description # Compiler changes N/A # Binaries changes - Facade call defaultFacadeAction (if exists) if invalid action requested # Updated Bash framework functions N/A # New Bash framework functions N/A # Documentation N/A # Validation/Tooling - upgraded megalinter to version 3.10.0 - pre-commit go back from prettier v4.0.0-alpha.8 to v4.0.0-alpha.4 because of the error "No files matching the given patterns were found"
- Loading branch information
1 parent
42750bb
commit c962e32
Showing
13 changed files
with
181 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% [1;37mDESCRIPTION:[0m %> help generated by function | ||
[1;37mUSAGE:[0m test [OPTIONS] | ||
[1;37mUSAGE:[0m test [--file|-f <String>] | ||
|
||
[1;37mOPTIONS:[0m | ||
[1;34m--file[0m, [1;34m-f <String>[0m {single} | ||
file | ||
long help generated by function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
Options::command() { | ||
local options_parse_cmd="$1" | ||
shift || true | ||
|
||
if [[ "${options_parse_cmd}" = "parse" ]]; then | ||
local -i options_parse_optionParsedCountFile | ||
((options_parse_optionParsedCountFile = 0)) || true | ||
# shellcheck disable=SC2034 | ||
local -i options_parse_parsedArgIndex=0 | ||
while (($# > 0)); do | ||
local options_parse_arg="$1" | ||
local argOptDefaultBehavior=0 | ||
case "${options_parse_arg}" in | ||
# Option 1/1 | ||
# Option file --file|-f variableType String min 0 max 1 authorizedValues '' regexp '' | ||
--file | -f) | ||
shift | ||
if (($# == 0)); then | ||
Log::displayError "Command ${SCRIPT_NAME} - Option ${options_parse_arg} - a value needs to be specified" | ||
return 1 | ||
fi | ||
if ((options_parse_optionParsedCountFile >= 1)); then | ||
Log::displayError "Command ${SCRIPT_NAME} - Option ${options_parse_arg} - Maximum number of option occurrences reached(1)" | ||
return 1 | ||
fi | ||
((++options_parse_optionParsedCountFile)) | ||
# shellcheck disable=SC2034 | ||
file="$1" | ||
;; | ||
-*) | ||
if [[ "${argOptDefaultBehavior}" = "0" ]]; then | ||
Log::displayError "Command ${SCRIPT_NAME} - Invalid option ${options_parse_arg}" | ||
return 1 | ||
fi | ||
;; | ||
*) | ||
if [[ "${argOptDefaultBehavior}" = "0" ]]; then | ||
Log::displayError "Command ${SCRIPT_NAME} - Argument - too much arguments provided" | ||
return 1 | ||
fi | ||
;; | ||
esac | ||
shift || true | ||
done | ||
Log::displayDebug "Command ${SCRIPT_NAME} - parse arguments: ${BASH_FRAMEWORK_ARGV[*]}" | ||
Log::displayDebug "Command ${SCRIPT_NAME} - parse filtered arguments: ${BASH_FRAMEWORK_ARGV_FILTERED[*]}" | ||
elif [[ "${options_parse_cmd}" = "help" ]]; then | ||
Array::wrap2 ' ' 80 0 "<% ${__HELP_TITLE_COLOR}DESCRIPTION:${__RESET_COLOR} %>" "$(helpFunction)" | ||
echo | ||
|
||
echo -e "$(Array::wrap2 " " 80 2 "${__HELP_TITLE_COLOR}USAGE:${__RESET_COLOR}" "${SCRIPT_NAME}" "[OPTIONS]")" | ||
echo -e "$(Array::wrap2 " " 80 2 "${__HELP_TITLE_COLOR}USAGE:${__RESET_COLOR}" \ | ||
"${SCRIPT_NAME}" \ | ||
"[--file|-f <String>]")" | ||
echo | ||
echo -e "${__HELP_TITLE_COLOR}OPTIONS:${__RESET_COLOR}" | ||
echo -e " ${__HELP_OPTION_COLOR}--file${__HELP_NORMAL}, ${__HELP_OPTION_COLOR}-f <String>${__HELP_NORMAL} {single}" | ||
local -a helpArray | ||
# shellcheck disable=SC2054 | ||
helpArray=(file) | ||
echo -e " $(Array::wrap2 " " 76 4 "${helpArray[@]}")" | ||
Array::wrap2 ' ' 76 0 "$(longHelpFunction)" | ||
else | ||
Log::displayError "Command ${SCRIPT_NAME} - Option command invalid: '${options_parse_cmd}'" | ||
return 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters