Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magerun 7.0.0+ prints out short & long form parameters as the long form | Does not recognise shortform alias #1295

Closed
furan917 opened this issue Sep 15, 2023 · 4 comments
Assignees
Labels
bug reproduced Issue could be reproduced
Milestone

Comments

@furan917
Copy link

furan917 commented Sep 15, 2023

Describe the bug

If you run a command that has the wrong argument in it, or in at least potentially one case the right argument, n98-magerun returns a list of allowed arguments however both the - & -- have the same text.

Expected behaviour

If I run n98-magerun setup:static-content:deploy -fakeParamHere it should return the expected option doesn't exist error with an output of the command and allowed/expected arguments.

setup:static-content:deploy [-f|--force] [-s|--strategy [STRATEGY]] [-a|--area [AREA]] [--exclude-area [EXCLUDE-AREA]] [-t|--theme [THEME]] [--exclude-theme [EXCLUDE-THEME]] [-l|--language [LANGUAGE]] [--exclude-language [EXCLUDE-LANGUAGE]] [-j|--jobs [JOBS]] [--max-execution-time [MAX-EXECUTION-TIME]] [--symlink-locale] [--content-version CONTENT-VERSION] [--refresh-content-version-only] [--no-javascript] [--no-js-bundle] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [--no-parent] [--] [<languages>...]

However when I run that, at least on all v7 version, I get the following output

setup:static-content:deploy [-force|--force] [-strategy|--strategy [STRATEGY]] [-area|--area [AREA]] [-exclude-area|--exclude-area [EXCLUDE-AREA]] [-theme|--theme [THEME]] [-exclude-theme|--exclude-theme [EXCLUDE-THEME]] [-language|--language [LANGUAGE]] [-exclude-language|--exclude-language [EXCLUDE-LANGUAGE]] [-jobs|--jobs [JOBS]] [-max-execution-time|--max-execution-time [MAX-EXECUTION-TIME]] [-symlink-locale|--symlink-locale] [-content-version|--content-version [CONTENT-VERSION]] [-refresh-content-version-only|--refresh-content-version-only] [-no-javascript|--no-javascript] [-no-js-bundle|--no-js-bundle] [-no-css|--no-css] [-no-less|--no-less] [-no-images|--no-images] [-no-fonts|--no-fonts] [-no-html|--no-html] [-no-misc|--no-misc] [-no-html-minify|--no-html-minify] [-no-parent|--no-parent] [--] [<languages>...]

as you can see, it doesn't correctly print the right shorthand.

Note: Expected output was from a run via bin/magento and the second one via n98-magerun on the same system and install running M2 v2.4.5-p2

Steps to reproduce the issue

Install any version from v7.0.0 to v7.1.0 and run n98-magerun setup:static-content:deploy -fakeParamHere to purposely generate the error message.

Technical details

Replicated on Ubuntu 22/20, AmazonLinux 1/2 and Mac M2 venture 13.5.2. On all v7 tags, and testest on 2.4.4, 2.4.5-p2 and 2.4.6

Additional context

Also, I am still digging into it but also try:
./n98-magerun2.phar setup:static-content:deploy -f (any v7 variant)
vs
./n98-magerun2-6.1.1.phar setup:static-content:deploy -f
vs
bin/magento setup:static-content:deploy -f

Let me know if you also get magerun saying "-f" option does not exist but the bin/magento works or the "-s"

@furan917 furan917 added the bug label Sep 15, 2023
@furan917 furan917 changed the title Magerun 7.1.0 prints out short & long form parameters as the long form. Magerun 7.0.0+ prints out short & long form parameters as the long form. Sep 15, 2023
@cmuench cmuench self-assigned this Sep 15, 2023
@cmuench cmuench added the reproduced Issue could be reproduced label Sep 15, 2023
cmuench added a commit to cmuench/n98-magerun2 that referenced this issue Sep 15, 2023
@cmuench cmuench added this to the 7.2.0 milestone Sep 15, 2023
@cmuench
Copy link
Member

cmuench commented Sep 15, 2023

@furan917 The issues should be fixed. You can update your phar file to develop version by running n98-magerun2.phar self-update --unstable to verify if it works with the short options.

Your example with setup:static-content:deploy -s should work now. It's registering the shortcut option (now).

The -fakeParam is not validated in the core command.

@furan917
Copy link
Author

furan917 commented Sep 15, 2023

@cmuench Amazing! Thank you.

I can confirm that the tested -s and -f arguments for setup:static-content:deploy now work correctly, and that when printing arguments it now prints out the correct short/long form.

This was the purpose of the fake-param in testing, to validate the we get the correct error response I used setup:static-content:deploy -f --ssh

This now prints out


  The "--ssh" option does not exist.

setup:static-content:deploy [-f|--force] [-s|--strategy [STRATEGY]] [-a|--area [AREA]] [--exclude-area [EXCLUDE-AREA]] [-t|--theme [THEME]] [--exclude-theme [EXCLUDE-THEME]] [-l|--language [LANGUAGE]] [--exclude-language [EXCLUDE-LANGUAGE]] [-j|--jobs [JOBS]] [--max-execution-time [MAX-EXECUTION-TIME]] [--symlink-locale] [--content-version [CONTENT-VERSION]] [--refresh-content-version-only] [--no-javascript] [--no-js-bundle] [--no-css] [--no-less] [--no-images] [--no-fonts] [--no-html] [--no-misc] [--no-html-minify] [--no-parent] [--] [<languages>...]

We ignore the --shh option does not exist because, well, we purposely are generating this error haha. But we can see the alias's are now correct. All is well.

@cmuench
Copy link
Member

cmuench commented Sep 15, 2023

@furan917 Great. I will deploy that fix then with the upcoming 7.2.0 release.

@furan917 furan917 changed the title Magerun 7.0.0+ prints out short & long form parameters as the long form. Magerun 7.0.0+ prints out short & long form parameters as the long form | Does not recognise shortform alias Sep 15, 2023
@cmuench
Copy link
Member

cmuench commented Oct 10, 2023

Will be released, soon.

@cmuench cmuench closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reproduced Issue could be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants