diff --git a/Scripts/Bash/Functions/cli_doParseArguments.sh b/Scripts/Bash/Functions/cli_doParseArguments.sh index ec13ecd..1f9126e 100755 --- a/Scripts/Bash/Functions/cli_doParseArguments.sh +++ b/Scripts/Bash/Functions/cli_doParseArguments.sh @@ -26,6 +26,27 @@ function cli_doParseArguments { + local ARG1='' + local ARG2='' + local COUNT=0 + + # Verify no option has been passed twice in the command-line. + for ARG1 in $ARGUMENTS;do + ARG1=$(echo $ARG1 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") + for ARG2 in $ARGUMENTS;do + ARG2=$(echo $ARG2 | sed -r "s!^'(--[[:alpha:]-]+)=?.+'!\1!") + if [[ $ARG1 == $ARG2 ]];then + COUNT=$(($COUNT + 1)) + fi + #echo "$ARG1 : $ARG2 : $COUNT" + if [[ $COUNT -gt 1 ]];then + cli_printMessage "`eval_gettext "The option \\\`\\\$ARG1' can't be duplicated."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + done + COUNT=0 + done + # Reset positional parameters using optional arguments. eval set -- "$ARGUMENTS"