-
Notifications
You must be signed in to change notification settings - Fork 124
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
Added wildcard support to groovyw <item> get #342
Added wildcard support to groovyw <item> get #342
Conversation
Can one of the admins please verify this patch? |
Hey, looks nice frome here--haven't tested, just glanced at the code. Can you rebase onto develop for me? There were some groovy-related module fetching PRs merged between when you started this branch and now. I tried locally, there shouldn't be any rebase conflicts. |
The groovyw.bat file has been changed to escape the asterisk parameters, which are otherwise expanded (which breaks the command).
This allows commands such as 'groovyw module get d*', which would return all the modules that start with a 'd'. The file groovyw.bat has been modifed to pass the arguments correctly so that this can happen.
6a9376b
to
8f883df
Compare
The commits should now be rebased onto develop. |
So I've tested this extensively and all the features work as intended but there is one small problem: The For example: Please fix this issue. Everything else is working as intended. Nice Work! |
The issue should be fixed now. Thank you for testing this. I believe, after further testing myself, that with this change, the wildcards should work now in most user-supplied cases. |
Hey! Please try if you can fix this issue |
Hey, @arpitkamboj , I'm afraid the issue you are describing arises from |
The sh script was not modified, as it always required quotes anyway.
This issue should be fixed on Windows, for the arguments are preserved as-is and I just needed to escape them before passing them as arguments to the java executable. I was doing the same for the "*" character anyway. I can't do anything about the sh script though, as the parameter expansion seems to happen before the arguments are passed to the script. Thanks for the advice @Adrijaned. I have added a note about this to my original message and added test-cases there so that I am not caught out by that issue again. |
@GooeyHub : add to whitelist |
Hooray Jenkins reported success with all tests good! |
Bump - I've reviewed this on the Terasology side and wanted to refer to the comments from here since they likely relate on both sides. Somewhat concerned about the OS complexities introduced by the wildcarding on command line. MovingBlocks/Terasology#3531 Otherwise agreed this is very good work, especially the thorough testing, so thank you so much for that :-) |
Hooray Jenkins reported success with all tests good! |
A more accurate description of when to escape wildcards has also been added.
Hooray Jenkins reported success with all tests good! |
Update: I have added to this for Terasology and tested it out fairly thoroughly. We should be able to merge this here then override with the related files from there, double check / lightly test, then merge. Was aiming to do that now but I hit #414 on my main test system while out of town. Should be easy to do later or for somebody else. See MovingBlocks/Terasology#3531 for details along with #3679 which I also merged and MovingBlocks/Terasology@dbc32f0 which I added on top. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works, further review has been done prior on the Terasology PR, merging
…card Added wildcard support to groovyw <item> get
Description
This PR adds wildcard support to the
groovyw <item> get <object>
e.g.groovyw <item> get *
.Testing
Testing this PR could take some considerable time and effort to check all of the use-cases are correct, so these changes should only apply if wildcards (
*
or?
) are detected in the input argument (see Line 61 of util.groovy). As such, I will list the series of tests that I have tried so far:Single argument tests:
groovyw module get *
groovyw module get d??p*
groovyw module get s??????
groovyw module get f?rm?c
groovyw module get t*
groovyw module get *de*
Multiple argument tests:
groovyw module get *de* fo*
groovyw module get f* d???*
Testing regex characters:
groovyw module get .
groovyw module get (
groovyw module get )
groovyw module get []
groovyw module get *
Testing multiple wildcards in succession:
groovyw module get ??????
groovyw module get ******
Outstanding Work
[
,]
,(
,)
,*
,.
,\
) are not injected into the code as regexesgroovyw module get *de* fo*
, which should obtain both the deepspace, federal modules, as well as the deepspace and the formic module.Notes
This should not break any existing functionality, as the new wildcard handling code is only used when the
*
or?
symbols are found.The wildcard strings will have to be escaped using single quotes (e.g.
./groovyw module get '*'
rather than./groovyw module get *
) on POSIX platforms (Linux and MacOS), as otherwise the terminal appears to automatically expand them (replacing the arguments with the names all the files in the current directory matching that descriptor) before passing them to the program. I have modified the Windows script to automatically escape the arguments, although I am not sure if it is possible with POSIX platforms to do so.