Adding any invalid argument would allow the command to run. The change in logic here corrects the conditional to print the help message when there are leftover arguments (i.e. arguments unparsed by the loop above this) resolving the issue and allowing non-interactive setup to work as expected.
This also adds error handling on the argument parsing to print a message informing the user which argument the loop failed to parse:
Running the following (for example) would fail prior to this change:
Adding any invalid argument would allow the command to run. The change in logic here corrects the conditional to print the help message when there are leftover arguments (i.e. arguments unparsed by the loop above this) resolving the issue and allowing non-interactive setup to work as expected.
This also adds error handling on the argument parsing to print a message informing the user which argument the loop failed to parse: