-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiled postmanCli using go compiler
- Loading branch information
1 parent
2bd43f7
commit cd133d9
Showing
9 changed files
with
1,876 additions
and
1,545 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,66 @@ | ||
extends: | ||
- "${BASH_TOOLS_ROOT_DIR}/src/_binaries/commandDefinitions/optionsVersion.yaml" | ||
- "${FRAMEWORK_ROOT_DIR}/src/_binaries/commandDefinitions/defaultCommand.yaml" | ||
- "${FRAMEWORK_ROOT_DIR}/src/_binaries/commandDefinitions/frameworkConfig.yaml" | ||
|
||
vars: | ||
SRC_FILE_PATH: src/_binaries/Postman/postmanCli/postmanCli-binary.yaml | ||
|
||
compilerConfig: | ||
targetFile: "${BASH_TOOLS_ROOT_DIR}/bin/postmanCli" | ||
relativeRootDirBasedOnTargetDir: .. | ||
srcDirs: | ||
- ${BASH_TOOLS_ROOT_DIR}/src | ||
binData: | ||
commands: | ||
default: | ||
functionName: postmanCliCommand | ||
version: "3.0" | ||
copyrightBeginYear: 2020 | ||
commandName: postmanCli | ||
beforeParseCallbacks: | ||
- beforeParseCallback | ||
unknownOptionCallbacks: | ||
- unknownOption | ||
unknownArgumentCallbacks: | ||
- unknownOption | ||
callbacks: | ||
- postmanCliCommandCallback | ||
definitionFiles: | ||
20: ${BASH_TOOLS_ROOT_DIR}/src/_binaries/Postman/postmanCli/postmanCli-options.sh | ||
mainFile: ${BASH_TOOLS_ROOT_DIR}/src/_binaries/Postman/postmanCli/postmanCli-main.sh | ||
help: Push/Pull postman collections of all the configured repositories. | ||
longDescription: longDescriptionFunction | ||
args: | ||
- type: String | ||
min: 0 | ||
max: 1 | ||
help: argCommandHelpFunction | ||
authorizedValues: | ||
- value: pull | ||
help: Pull | ||
- value: push | ||
help: Push | ||
name: command | ||
variableName: argCommand | ||
|
||
- type: String | ||
min: 0 | ||
max: -1 | ||
help: commandArgsHelpFunction | ||
name: ref | ||
variableName: commandArgs | ||
|
||
optionGroups: | ||
groupPushPull: | ||
title: "PUSH/PULL OPTIONS:" | ||
|
||
options: | ||
- variableName: optionPostmanModelConfig | ||
type: String | ||
group: groupPushPull | ||
help: optionPostmanModelConfigHelpFunction | ||
helpValueName: configFile | ||
alts: | ||
- --postman-model | ||
- -m |
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,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# shellcheck disable=SC2154 | ||
case "${argCommand}" in | ||
pull) | ||
Postman::Commands::pullCommand "${optionPostmanModelConfig}" "${commandArgs[@]}" | ||
;; | ||
push) | ||
Postman::Commands::pushCommand "${optionPostmanModelConfig}" "${commandArgs[@]}" | ||
;; | ||
*) | ||
Log::displayError "Invalid command ${argCommand}" | ||
exit 1 | ||
;; | ||
esac |
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,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
longDescriptionFunction() { | ||
echo -e " ${__HELP_TITLE}EXIT CODES:${__HELP_NORMAL}" | ||
echo -e " ${__HELP_OPTION_COLOR}1${__HELP_NORMAL}: if commit does not exists" | ||
echo -e " ${__HELP_OPTION_COLOR}2${__HELP_NORMAL}: if ref is not convertible to commit oid" | ||
echo -e " ${__HELP_OPTION_COLOR}3${__HELP_NORMAL}: if commit is not included in given branch" | ||
} | ||
|
||
optionHelpCallback() { | ||
postmanCliCommandHelp | ||
exit 0 | ||
} | ||
|
||
optionPostmanModelConfigHelpFunction() { | ||
echo " postmanCli model file to use" | ||
echo " Default value: <currentDir>/postmanCli.collections.json" | ||
} | ||
|
||
argCommandHelpFunction() { | ||
echo -e " ${__HELP_OPTION_COLOR}pull${__HELP_NORMAL}" | ||
echo -e " Pull collections from Postman back to repositories." | ||
echo -e " ${__HELP_OPTION_COLOR}push${__HELP_NORMAL}" | ||
echo -e ' Push repositories collections to Postman.' | ||
} | ||
|
||
commandArgsHelpFunction() { | ||
echo -e " List of postman collection's references to pull or push" | ||
echo -e " or no argument to pull or push all the collections" | ||
} | ||
|
||
# shellcheck disable=SC2317 # if function is overridden | ||
unknownOption() { | ||
commandArgs+=("$1") | ||
} | ||
|
||
postmanCliCommandCallback() { | ||
if [[ -z "${optionPostmanModelConfig}" ]]; then | ||
optionPostmanModelConfig="${CURRENT_DIR}/postmanCli.collections.json" | ||
fi | ||
if [[ ! -f "${optionPostmanModelConfig}" ]]; then | ||
Log::displayError "Please provide a valid postman config file, using --postman-model option." | ||
exit 1 | ||
fi | ||
if [[ "${displayConfig}" = "1" ]]; then | ||
# shellcheck disable=SC2154 | ||
Postman::Model::validate "${optionPostmanModelConfig}" "config" | ||
original_displayConfig | ||
UI::drawLine "-" | ||
printf '%-40s = %s\n' "POSTMAN_API_KEY" "${POSTMAN_API_KEY:0:15}...(truncated)" | ||
exit 0 | ||
fi | ||
} | ||
|
||
eval "original_$(declare -f displayConfig | grep -v 'exit 0')" | ||
declare displayConfig=0 | ||
displayConfig() { | ||
displayConfig=1 | ||
} |
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
76 changes: 76 additions & 0 deletions
76
src/_binaries/Postman/postmanCli/testsData/postmanCli.help.txt
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,76 @@ | ||
[1;37mSYNOPSIS:[0m | ||
Push/Pull postman collections of all the configured repositories. | ||
|
||
[1;37mUSAGE:[0m postmanCli [OPTIONS] [ARGUMENTS] | ||
[1;37mUSAGE:[0m postmanCli [--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] [--postman-model|-m <configFile>] | ||
|
||
[1;37mARGUMENTS:[0m | ||
[[1;34mcommand[0m {single}] | ||
[1;34mpull[0m | ||
Pull collections from Postman back to repositories. | ||
[1;34mpush[0m | ||
Push repositories collections to Postman. | ||
[[1;34mref[0m {list} (optional)] | ||
List of postman collection's references to pull or push | ||
or no argument to pull or push all the collections | ||
|
||
[1;37mGLOBAL OPTIONS:[0m | ||
[1;34m--help[0m, [1;34m-h[0m {single} | ||
Displays this command help | ||
[1;34m--config[0m {single} | ||
Displays configuration | ||
[1;34m--bash-framework-config <bash-framework-config>[0m {single} | ||
Use alternate bash framework configuration. | ||
[1;34m--verbose[0m, [1;34m-v[0m {single} | ||
Info level verbose mode (alias of --display-level INFO) | ||
[1;34m-vv[0m {single} | ||
Debug level verbose mode (alias of --display-level DEBUG) | ||
[1;34m-vvv[0m {single} | ||
Trace level verbose mode (alias of --display-level TRACE) | ||
[1;34m--env-file <env-file>[0m {list} (optional) | ||
Load the specified env file (deprecated, please use --bash-framework-con | ||
fig option instead) | ||
[1;34m--log-level <log-level>[0m {single} | ||
Set log level | ||
Possible values: OFF, ERR, ERROR, WARN, WARNING, INFO, DEBUG, TRACE | ||
[1;34m--log-file <log-file>[0m {single} | ||
Set log file | ||
[1;34m--display-level <display-level>[0m {single} | ||
Set display level | ||
Possible values: OFF, ERR, ERROR, WARN, WARNING, INFO, DEBUG, TRACE | ||
[1;34m--no-color[0m {single} | ||
Produce monochrome output. alias of --theme noColor. | ||
[1;34m--theme <theme>[0m {single} | ||
Choose color theme - default-force means colors will be produced even if | ||
command is piped. | ||
Possible values: default, default-force, noColor | ||
Default value: default | ||
[1;34m--version[0m {single} | ||
Print version information and quit. | ||
[1;34m--quiet[0m, [1;34m-q[0m {single} | ||
Quiet mode, doesn't display any output. | ||
|
||
[1;37mPUSH/PULL OPTIONS:[0m | ||
[1;34m--postman-model[0m, [1;34m-m <configFile>[0m {single} | ||
postmanCli model file to use | ||
Default value: <currentDir>/postmanCli.collections.json | ||
|
||
|
||
[1;37mDESCRIPTION:[0m | ||
[1;37mEXIT CODES:[0m | ||
[1;34m1[0m: if commit does not exists | ||
[1;34m2[0m: if ref is not convertible to commit oid | ||
[1;34m3[0m: if commit is not included in given branch | ||
|
||
[1;37mVERSION: [0m3.0 | ||
|
||
[1;37mAUTHOR: [0m[François Chastanet](https://github.com/fchastanet) | ||
|
||
[1;37mSOURCE FILE: [0mhttps://github.com/fchastanet/bash-tools-framework/tree/master/src/_binaries/Postman/postmanCli/postmanCli-binary.yaml | ||
|
||
[1;37mLICENSE: [0mMIT License | ||
Copyright (c) 2020-now François Chastanet |
Oops, something went wrong.