Fix branch= usage

This commit is contained in:
Maniack Crudelis 2020-04-30 01:09:38 +02:00
parent cb24568248
commit a865689c84

View file

@ -60,18 +60,24 @@ then
else else
# Store arguments in a array to keep each argument separated # Store arguments in a array to keep each argument separated
arguments=("$@") arguments=("$@")
getopts_built_arg=()
# Read the array value per value # Read the array value per value
for i in `seq 0 $(( ${#arguments[@]} -1 ))` for i in `seq 0 $(( ${#arguments[@]} -1 ))`
do do
if [[ "${arguments[$i]}" =~ "--branch=" ]]
then
getopts_built_arg+=(-b)
arguments[$i]=${arguments[$i]//--branch=/}
fi
# For each argument in the array, reduce to short argument for getopts # For each argument in the array, reduce to short argument for getopts
arguments[$i]=${arguments[$i]//--branch=/-b}
arguments[$i]=${arguments[$i]//--force-install-ok/-f} arguments[$i]=${arguments[$i]//--force-install-ok/-f}
arguments[$i]=${arguments[$i]//--interrupt/-i} arguments[$i]=${arguments[$i]//--interrupt/-i}
arguments[$i]=${arguments[$i]//--help/-h} arguments[$i]=${arguments[$i]//--help/-h}
arguments[$i]=${arguments[$i]//--build-lxc/-l} arguments[$i]=${arguments[$i]//--build-lxc/-l}
arguments[$i]=${arguments[$i]//--bash-mode/-y} arguments[$i]=${arguments[$i]//--bash-mode/-y}
arguments[$i]=${arguments[$i]//--show-resources/-r} arguments[$i]=${arguments[$i]//--show-resources/-r}
getopts_built_arg+=(${arguments[$i]})
done done
# Read and parse all the arguments # Read and parse all the arguments
@ -144,7 +150,7 @@ else
} }
# Call parse_arg and pass the modified list of args as a array of arguments. # Call parse_arg and pass the modified list of args as a array of arguments.
parse_arg "${arguments[@]}" parse_arg "${getopts_built_arg[@]}"
fi fi
# Prevent a conflict between --interrupt and --bash-mode # Prevent a conflict between --interrupt and --bash-mode