diff --git a/Makefile b/Makefile index 204b6e6..5081154 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ project-help: @$(SCRIPTS_BASE)/project.sh help project-tools: - @$(SCRIPTS_BASE)/project.sh tools + @$(SCRIPTS_BASE)/project.sh tools "$(LANGUAGE)" # GENERATE download-oas: diff --git a/scripts/generate-sdk/languages/python.sh b/scripts/generate-sdk/languages/python.sh index c4737b4..3164855 100644 --- a/scripts/generate-sdk/languages/python.sh +++ b/scripts/generate-sdk/languages/python.sh @@ -58,7 +58,7 @@ generate_python_sdk() { # Install SDK project tools cd ${ROOT_DIR} - make project-tools + make project-tools LANGUAGE=python # Backup of the current state of the SDK services dir (services/) sdk_services_backup_dir=$(mktemp -d) diff --git a/scripts/project.sh b/scripts/project.sh index 32dde63..8b3faa7 100755 --- a/scripts/project.sh +++ b/scripts/project.sh @@ -11,13 +11,24 @@ SDK_PATH="${ROOT_DIR}/sdk" action=$1 +if [[ -z $2 ]]; then + echo "LANGUAGE not specified, default will be used." + LANGUAGE="go" +else + LANGUAGE=$2 +fi + if [ "$action" = "help" ]; then [ -f "$0".man ] && man "$0".man || echo "No help, please read the script in ${script}, we will add help later" elif [ "$action" = "tools" ]; then cd ${ROOT_DIR} - - go install golang.org/x/tools/cmd/goimports@latest - pip install black==24.8.0 isort~=5.13.2 autoimport~=1.6.1 + if [ "${LANGUAGE}" == "go" ]; then + go install golang.org/x/tools/cmd/goimports@latest + elif [ "${LANGUAGE}" == "python" ]; then + pip install black==24.8.0 isort~=5.13.2 autoimport~=1.6.1 + else + echo "Invalid language: `$LANGUAGE`, please use $0 help for help" + fi else echo "Invalid action: '$action', please use $0 help for help" fi