-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Enhancement: Add support for filtering files in Globbing alias #1384
Labels
Milestone
Comments
For what it's worth & work doesn't get duplicated, I've made good progress in extending the globbing to support this and expect to have a PR for it in the next couple of days. |
kcamp
added a commit
to kcamp/cake
that referenced
this issue
Jan 20, 2019
…liases This refactors/revisits a previous attempt to achieve the same. Earlier work was based on methods/implementations that would have come to rely on method overloads (before the GlobberSettings implementation was added). Now that the settings type exists, this represents a much stronger feature/change without any potential risk for backward compatibility. i.e., an implicitly typed predicate specified as IFileSystemInfo would have created ambiguity between the desired overloads - GetFiles(string pattern, Func<IFile, bool> predicate) and GetFiles(string pattern, Func<IDirectory,bool> predicate) resulting in unpredictable behavior. This adds the member to the GlobberSettings type and wires in all the necessary logic, providing a clean implementation that relies on default values (null) and a single point of entry for invocation to provide a flexible solution without the syntactic overhead.
kcamp
added a commit
to kcamp/cake
that referenced
this issue
Feb 15, 2019
…liases This refactors/revisits a previous attempt to achieve the same. Earlier work was based on methods/implementations that would have come to rely on method overloads (before the GlobberSettings implementation was added). Now that the settings type exists, this represents a much stronger feature/change without any potential risk for backward compatibility. i.e., an implicitly typed predicate specified as IFileSystemInfo would have created ambiguity between the desired overloads - GetFiles(string pattern, Func<IFile, bool> predicate) and GetFiles(string pattern, Func<IDirectory,bool> predicate) resulting in unpredictable behavior. This adds the member to the GlobberSettings type and wires in all the necessary logic, providing a clean implementation that relies on default values (null) and a single point of entry for invocation to provide a flexible solution without the syntactic overhead.
kcamp
added a commit
to kcamp/cake
that referenced
this issue
Feb 20, 2019
…liases This refactors/revisits a previous attempt to achieve the same. Earlier work was based on methods/implementations that would have come to rely on method overloads (before the GlobberSettings implementation was added). Now that the settings type exists, this represents a much stronger feature/change without any potential risk for backward compatibility. i.e., an implicitly typed predicate specified as IFileSystemInfo would have created ambiguity between the desired overloads - GetFiles(string pattern, Func<IFile, bool> predicate) and GetFiles(string pattern, Func<IDirectory,bool> predicate) resulting in unpredictable behavior. This adds the member to the GlobberSettings type and wires in all the necessary logic, providing a clean implementation that relies on default values (null) and a single point of entry for invocation to provide a flexible solution without the syntactic overhead.
kcamp
added a commit
to kcamp/cake
that referenced
this issue
Feb 21, 2019
…liases This refactors/revisits a previous attempt to achieve the same. Earlier work was based on methods/implementations that would have come to rely on method overloads (before the GlobberSettings implementation was added). Now that the settings type exists, this represents a much stronger feature/change without any potential risk for backward compatibility. i.e., an implicitly typed predicate specified as IFileSystemInfo would have created ambiguity between the desired overloads - GetFiles(string pattern, Func<IFile, bool> predicate) and GetFiles(string pattern, Func<IDirectory,bool> predicate) resulting in unpredictable behavior. This adds the member to the GlobberSettings type and wires in all the necessary logic, providing a clean implementation that relies on default values (null) and a single point of entry for invocation to provide a flexible solution without the syntactic overhead.
devlead
pushed a commit
to kcamp/cake
that referenced
this issue
Feb 27, 2019
…liases This refactors/revisits a previous attempt to achieve the same. Earlier work was based on methods/implementations that would have come to rely on method overloads (before the GlobberSettings implementation was added). Now that the settings type exists, this represents a much stronger feature/change without any potential risk for backward compatibility. i.e., an implicitly typed predicate specified as IFileSystemInfo would have created ambiguity between the desired overloads - GetFiles(string pattern, Func<IFile, bool> predicate) and GetFiles(string pattern, Func<IDirectory,bool> predicate) resulting in unpredictable behavior. This adds the member to the GlobberSettings type and wires in all the necessary logic, providing a clean implementation that relies on default values (null) and a single point of entry for invocation to provide a flexible solution without the syntactic overhead.
Fixed by #2458 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GlobbingAliases.cs
has support for filtering the globbing traversal at the directory level, but no support for filtering files. I have found that support for logic that is more complex than the globbing expression allows has been useful, and have seen gitter traffic for the same issue.This would be a trivial addition to make at the method alias level. I would propose that two overloads be created --
The former would satisfy the direct need of the feature request, the latter would provide a graceful pairing of current + extended logic.
Assuming that this is something that seems useful and aligned with the intent of the project, the question I would raise is whether it's more appropriate to implement the logic directly in the alias method, similar to ..
or whether it would be more appropriately implemented in the globbing internals --
GlobVisitor
,GlobVisitorContext
, and so on.Constraining it to the alias would certainly be less involved, but the latter seems like it would probably be a cleaner (and faster) implementation, particularly in eliminating the extra calls to
FileSystem.GetFile(...)
- it seems quite apt that it would amount to refactoring theGlobVisitor
andGlobVisitorContext
so that the logic inFindCandidates
would be extended to encompass something like ..Thoughts on whether or not this would be worth pursuing? Any other feedback?
The text was updated successfully, but these errors were encountered: