Fix report problem, improve option flexibility

This commit is contained in:
frtabu
2019-06-11 19:58:47 +02:00
parent 13a079c855
commit 05e7e3e0a8
2 changed files with 87 additions and 37 deletions
+31 -18
View File
@@ -35,26 +35,39 @@ function build_usage {
echo ""
echo "Mandatory Options:"
echo "--------"
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
local -A HELP_BUILD
HELP_BUILD["jn"]=" Specify the name of the Jenkins job."
HELP_BUILD["id"]=" Specify the build ID of the Jenkins job."
HELP_BUILD["ws"]=" Specify the workspace"
for (( i=0 ; i<${#SHORT_OPTIONS[@]} ; i++ ))
do
if [ $(( MANDATORY_OPTMASK & $(( 2**$i )) )) -ne 0 ]
then
if [ "${LONG_OPTIONS[$i]}" != "" ]
then
printf " %s #### OR " "--${LONG_OPTIONS[$i]}"
fi
printf "%s #### \n" "-${SHORT_OPTIONS[$i]}"
printf " %s\n\n" "${HELP_BUILD[${SHORT_OPTIONS[$i]}]}"
fi
done
echo "Options:"
echo "--------"
variant_usage
echo " Specify the variant to build."
echo ""
echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build."
echo ""
echo " --daemon OR -D"
echo " Run as daemon"
echo ""
HELP_BUILD["var"]=" Specify the variant to build."
HELP_BUILD["k"]=" Keep the VM alive after the build."
HELP_BUILD["D"]=" Run as daemon"
for (( i=0 ; i<${#SHORT_OPTIONS[@]} ; i++ ))
do
if [ $(( ALLOWED_OPTMASK & $(( 2**$i )) )) -ne 0 ]
then
if [ "${LONG_OPTIONS[$i]}" != "" ]
then
printf " %s #### OR " "--${LONG_OPTIONS[$i]}"
fi
printf "%s #### \n" "-${SHORT_OPTIONS[$i]}"
printf " %s\n\n" "${HELP_BUILD[${SHORT_OPTIONS[$i]}]}"
fi
done
echo " --help OR -h"
echo " Print this help message."
echo ""