Skip to content

Commit

Permalink
fixed UT
Browse files Browse the repository at this point in the history
  • Loading branch information
fchastanet committed Jan 15, 2024
1 parent dccf059 commit 78d800f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
11 changes: 9 additions & 2 deletions bin/postmanCli
Original file line number Diff line number Diff line change
Expand Up @@ -1929,8 +1929,8 @@ postmanCliCommand() {
echo -e "${__HELP_TITLE_COLOR}ARGUMENTS:${__RESET_COLOR}"
echo -e " [${__HELP_OPTION_COLOR}command${__HELP_NORMAL} {single}]"
local -a helpArray
# shellcheck disable=SC2054
helpArray=($'\e[1;34mpull[0m\r\n Pull collections from Postman back to repositories.\r\n\e[1;34mpush[0m\r\n Push repositories collections to Postman.')
# shellcheck disable=SC2054,SC2206
mapfile -t helpArray < <(argCommandHelp)
echo -e " $(Array::wrap2 " " 76 4 "${helpArray[@]}")"
echo -e " [${__HELP_OPTION_COLOR}commandArgs${__HELP_NORMAL} {list} (optional)]"
local -a helpArray
Expand Down Expand Up @@ -2042,6 +2042,13 @@ postmanCliCommand() {
declare optionPostmanModelConfig="$(pwd -P)/postmanCli.collections.json"
declare copyrightBeginYear="2023"

argCommandHelp() {
echo "${__HELP_OPTION_COLOR}pull${__HELP_NORMAL}" $'\r'
echo " Pull collections from Postman back to repositories." $'\r'
echo "${__HELP_OPTION_COLOR}push${__HELP_NORMAL}" $'\r'
echo ' Push repositories collections to Postman.'
}

# shellcheck disable=SC2317 # if function is overridden
unknownOption() {
commandArgs+=("$1")
Expand Down
13 changes: 9 additions & 4 deletions src/_binaries/Postman/command.postmanCli.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ Default value: <currentDir>/postmanCli.collections.json' \
--variable-name "optionPostmanModelConfig" \
--function-name optionPostmanModelConfigFunction

argCommandHelp() { :; }
Options::generateArg \
--variable-name "argCommand" \
--min 0 \
--max 1 \
--name "command" \
--authorized-values 'pull|push' \
--help $'${__HELP_OPTION_COLOR}pull${__HELP_NORMAL}\r
Pull collections from Postman back to repositories.\r
${__HELP_OPTION_COLOR}push${__HELP_NORMAL}\r
Push repositories collections to Postman.' \
--help argCommandHelp \
--function-name argCommandFunction

Options::generateArg \
Expand All @@ -62,6 +60,13 @@ Options::generateCommand "${options[@]}"
declare optionPostmanModelConfig="$(pwd -P)/postmanCli.collections.json"
declare copyrightBeginYear="2023"

argCommandHelp() {
echo "${__HELP_OPTION_COLOR}pull${__HELP_NORMAL}" $'\r'
echo " Pull collections from Postman back to repositories." $'\r'
echo "${__HELP_OPTION_COLOR}push${__HELP_NORMAL}" $'\r'
echo ' Push repositories collections to Postman.'
}

# shellcheck disable=SC2317 # if function is overridden
unknownOption() {
commandArgs+=("$1")
Expand Down
6 changes: 4 additions & 2 deletions src/_binaries/Postman/testsData/postmanCli.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Push/Pull postman collections of all the configured repositories

ARGUMENTS:
[command {single}]
pull   Pull collections from Postman back to repositories.
push   Push repositories collections to Postman.
pull
Pull collections from Postman back to repositories.
push
Push repositories collections to Postman.
[commandArgs {list} (optional)]
list of postman collection's references to pull or push
or no argument to pull or push all the collections
Expand Down

0 comments on commit 78d800f

Please sign in to comment.