mage2click / docker-magento-mutagen

Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
https://mage2.click
MIT License
68 stars 9 forks source link

Fixed setup script printing help message in non-interactive mode #23

Closed davidalger closed 5 years ago

davidalger commented 5 years ago

Running the following (for example) would fail prior to this change:

setup.sh --domain=mysite.test --magento-db=/tmp/mysite.sql --magento-project=/sites/vaporbeast.vbst --php-version=7.1 --mailhog --rabbitmq --elasticsearch --elasticsearch-version=5.6

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:

$ ./setup.sh --foo=bar --foobar
Error: Unrecognized argument: --foo=bar
Error: Unrecognized argument: --foobar
+------------------------------------------------------+
|                                                      |
| Mage2click                                           |
|                                                      |
| #Docker #Magento #Mutagen development environment    |
|                                                      |
| https://mage2.click                                  |
| https://github.com/mage2click/docker-magento-mutagen |
|                                                      |
+------------------------------------------------------+