[Docker] Added a check to make sure an argument is passed (#6207)

* added a check to make sure an argument is passed

* list available commands
This commit is contained in:
Robin Wood 2020-05-08 04:22:03 +01:00 committed by GitHub
parent 8c6236b341
commit 6e619e0a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,16 @@ codegen="${cli}/target/openapi-generator-cli.jar"
# We code in a list of commands here as source processing is potentially buggy (requires undocumented conventional use of annotations).
# A list of known commands helps us determine if we should compile CLI. There's an edge-case where a new command not added to this
# list won't be considered a "real" command. We can get around that a bit by checking CLI completions beforehand if it exists.
commands="list,generate,meta,help,config-help,validate,version"
commands="config-help,generate,help,list,meta,validate,version"
if [ $# == 0 ]; then
echo "No command specified. Available commands:"
for i in $(echo $commands | sed "s/,/ /g")
do
echo " $i"
done
exit
fi
# if CLI jar exists, check $1 against completions available in the CLI
if [[ -f "${codegen}" && -n "$(java ${JAVA_OPTS} -jar "${codegen}" completion | grep "^$1\$" )" ]]; then