diff --git a/.cspell/softwares.txt b/.cspell/softwares.txt index dc0199f7..666eb7e2 100644 --- a/.cspell/softwares.txt +++ b/.cspell/softwares.txt @@ -154,3 +154,9 @@ TRIVY KICS TRUFFLEHOG GRYPE +octocat +prerequest +slurpfile +EJSON +ejson +clairefro diff --git a/.jscpd.json b/.jscpd.json index ed84a6cf..bac9e1bc 100644 --- a/.jscpd.json +++ b/.jscpd.json @@ -25,6 +25,9 @@ "**/.idea/**", "**/report/**", "**/*.svg", - "**/testsData/**" + "**/testsData/**", + "conf/postmanCli/MongoDbData/MongoDBDataAPI.postman_collection.json", + "conf/postmanCli/GithubAPI/GitHubAPI-01-Basic_no_auth_postman_collection.json", + "conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json" ] } diff --git a/.mega-linter.yml b/.mega-linter.yml index 8e0aba5e..aa5a1924 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -109,3 +109,15 @@ SPELL_LYCHEE_FILTER_REGEX_EXCLUDE: | ) JSON_ESLINT_PLUGIN_JSONC_FILE_NAME: .eslintrc.js +JSON_PRETTIER_FILTER_REGEX_EXCLUDE: | + (?x)( + ^src/Postman/Model/testsData/pushMode/GithubAPI/notValidJsonFile.json$| + ^src/Postman/Collection/testsData/postmanCollections_invalidJsonFile.json$| + ^src/Postman/Model/testsData/getCollectionInvalid.json$ + ) +JSON_ESLINT_PLUGIN_JSONC_FILTER_REGEX_EXCLUDE: | + (?x)( + ^src/Postman/Model/testsData/pushMode/GithubAPI/notValidJsonFile.json$| + ^src/Postman/Collection/testsData/postmanCollections_invalidJsonFile.json$| + ^src/Postman/Model/testsData/getCollectionInvalid.json$ + ) diff --git a/Commands.tmpl.md b/Commands.tmpl.md index 0867bb51..609c49a0 100644 --- a/Commands.tmpl.md +++ b/Commands.tmpl.md @@ -21,8 +21,8 @@ - [4.1.3. Example 2: connect to mysql container with root user](#413-example-2-connect-to-mysql-container-with-root-user) - [4.1.4. Example 3: connect to mysql server in order to execute a query](#414-example-3-connect-to-mysql-server-in-order-to-execute-a-query) - [4.1.5. Example 4: pipe sql command to mysql container](#415-example-4-pipe-sql-command-to-mysql-container) - - [4.1. bin/postmanCli](#41-binpostmancli) - - [4.1.1. Help](#411-help-1) + - [4.2. bin/postmanCli](#42-binpostmancli) + - [4.2.1. Help](#421-help) - [5. Database tools](#5-database-tools) - [5.1. bin/dbQueryAllDatabases](#51-bindbqueryalldatabases) - [5.1.1. Help](#511-help) @@ -196,9 +196,9 @@ project-mysql //bin/bash -c 'mysql -h127.0.0.1 -uroot -proot -P3306' notice that as input is given to the command, tty option is not provided to docker exec -### 4.1. bin/postmanCli +### 4.2. bin/postmanCli -#### 4.1.1. Help +#### 4.2.1. Help ```text @@@postmanCli_help@@@ diff --git a/bin/postmanCli b/bin/postmanCli index 65abd4b7..e4f6a122 100755 --- a/bin/postmanCli +++ b/bin/postmanCli @@ -907,7 +907,7 @@ Postman::Commands::pullCollections() { echo "${response}" >"${collectionFile}" Log::displaySuccess "Collection '${collectionName}' has been pulled successfully to '${collectionFile}'" else - Log::displayError "Collection '${collectionName}' an error occured pulling the collection from postman" + Log::displayError "Collection '${collectionName}' an error occurred pulling the collection from postman" fi fi } @@ -958,7 +958,7 @@ Postman::Commands::pushCollections() { # exists in the model file # @arg $1 modelFile:String model file in which availableRefs have been retrieved # @arg $2 availableRefs:&String[] list of known collection references -# @arg $3 modelCollectionRefs:&String[] list ofcollection references to check +# @arg $3 modelCollectionRefs:&String[] list of collection references to check Postman::Model::checkIfValidCollectionRefs() { local modelFile="$1" local -n availableRefs=$2 @@ -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\r\n Pull collections from Postman back to repositories.\r\n\e[1;34mpush\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 @@ -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") diff --git a/conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json b/conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json index 249c0cbb..870a21d7 100644 --- a/conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json +++ b/conf/postmanCli/GithubAPI/GitHubAPI-02-Advanced_with_auth_postman_collection.json @@ -96,7 +96,7 @@ } ] }, - "description": "**WARNING!** Running this request will overwrite an existing file if specified filepath already exists in the provided repo, if you have the proper authorization credentials. Proceed with caution!\n\n## Before making this request \nEncode the file you would like to upload from your computer into base64 using request #1 above. \n\nThat request will save the base64 encoded file to a colelction variable called `encodedFileData`, which will be sent in the body of this request.\n\nEdit the values in the `Params` tab in the request before sending." + "description": "**WARNING!** Running this request will overwrite an existing file if specified filepath already exists in the provided repo, if you have the proper authorization credentials. Proceed with caution!\n\n## Before making this request \nEncode the file you would like to upload from your computer into base64 using request #1 above. \n\nThat request will save the base64 encoded file to a collection variable called `encodedFileData`, which will be sent in the body of this request.\n\nEdit the values in the `Params` tab in the request before sending." }, "response": [], "uid": "27246549-fb33abcc-8329-4fa9-9fbb-8e513f9307f6" diff --git a/conf/postmanCli/MongoDbData/Atlas.postman_environment.json b/conf/postmanCli/MongoDbData/Atlas.postman_environment.json index dc88c4f3..2b661ef0 100644 --- a/conf/postmanCli/MongoDbData/Atlas.postman_environment.json +++ b/conf/postmanCli/MongoDbData/Atlas.postman_environment.json @@ -73,7 +73,7 @@ "enabled": true }, { - "key": "PROJ-INVITATIO-ID", + "key": "PROJ-INVITATION-ID", "value": "", "enabled": true }, diff --git a/src/Postman/Commands/pullCollections.sh b/src/Postman/Commands/pullCollections.sh index 06d69030..c5a332b8 100755 --- a/src/Postman/Commands/pullCollections.sh +++ b/src/Postman/Commands/pullCollections.sh @@ -36,7 +36,7 @@ Postman::Commands::pullCollections() { echo "${response}" >"${collectionFile}" Log::displaySuccess "Collection '${collectionName}' has been pulled successfully to '${collectionFile}'" else - Log::displayError "Collection '${collectionName}' an error occured pulling the collection from postman" + Log::displayError "Collection '${collectionName}' an error occurred pulling the collection from postman" fi fi } diff --git a/src/Postman/Model/checkIfValidCollectionRefs.sh b/src/Postman/Model/checkIfValidCollectionRefs.sh index 778a08b3..dc53a205 100755 --- a/src/Postman/Model/checkIfValidCollectionRefs.sh +++ b/src/Postman/Model/checkIfValidCollectionRefs.sh @@ -4,7 +4,7 @@ # exists in the model file # @arg $1 modelFile:String model file in which availableRefs have been retrieved # @arg $2 availableRefs:&String[] list of known collection references -# @arg $3 modelCollectionRefs:&String[] list ofcollection references to check +# @arg $3 modelCollectionRefs:&String[] list of collection references to check Postman::Model::checkIfValidCollectionRefs() { local modelFile="$1" local -n availableRefs=$2 diff --git a/src/_binaries/Postman/command.postmanCli.tpl b/src/_binaries/Postman/command.postmanCli.tpl index fcc11883..e46935a3 100644 --- a/src/_binaries/Postman/command.postmanCli.tpl +++ b/src/_binaries/Postman/command.postmanCli.tpl @@ -26,16 +26,14 @@ Default value: /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 \ @@ -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") diff --git a/src/_binaries/Postman/testsData/postmanCli.help.txt b/src/_binaries/Postman/testsData/postmanCli.help.txt index 04c6028a..78dc41e6 100644 --- a/src/_binaries/Postman/testsData/postmanCli.help.txt +++ b/src/_binaries/Postman/testsData/postmanCli.help.txt @@ -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