Skip to content

Commit

Permalink
[Docker] Added a check to make sure an argument is passed (OpenAPIToo…
Browse files Browse the repository at this point in the history
…ls#6207)

* added a check to make sure an argument is passed

* list available commands
  • Loading branch information
digininja authored May 8, 2020
1 parent 8c6236b commit 6e619e0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e619e0

Please sign in to comment.