-
Notifications
You must be signed in to change notification settings - Fork 305
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
Allow Rsync::exclude to accept a list of patterns to exclude. #243
Conversation
return $this->option('exclude', escapeshellarg($pattern)); | ||
if (is_array($pattern)) { | ||
foreach ($pattern as $item) { | ||
$this->option('exclude', escapeshellarg($item)); |
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.
Please call $this->exclude
here to avoid duplication.
Useful PR! |
Sure thing! Thank you for the feedback. |
👍 |
…ionList. Add 'includeFilter' and 'filter' rsync options.
0bdf50a
to
f2e2928
Compare
At the risk of complicating this issue, I pushed another commit for consideration, adding 'includeFilter' and 'filter' options as well. To avoid repeating the same pattern over and over again, I factored the option list implementation into an optionLis() method in CommandArguments. The complication here is that, in order to be useful as a shorthand method, optionList() must call escapeshellarg on the values passed to it. This, however, makes optionList() inconsistent with option(), which does not escape. Changing option() is not a good option (no pun intend), because existing code expects that escapeshellarg is necessary, and we do not want to double-escape. Forcing callers of optionList to use an awkward array_map to escape their array values would be possible, but this just seemed awkward. In the end, I merely documented the difference, but could do it the other way if desired. |
Bump. This would be good to get in, but please consider the consistency-vs-backwards-compatibility issue above. |
Ok, looks good. |
Allow Rsync::exclude to accept a list of patterns to exclude.
This PR allows
taskRsync::exclude()
to take an array of patterns, in addition to its traditional parameter value of a single string.Motivation: sometimes, you might want to call taskRsync with a variable list of locations to exclude.
Before this PR:
After this PR: