EliziumNet / Loopz

PowerShell iteration utilities with additional tools like the Parameter Set Tools
https://eliziumnet.github.io/Loopz/
MIT License
3 stars 0 forks source link

define new filtering strategy: TraverseAll #192

Closed plastikfan closed 2 years ago

plastikfan commented 2 years ago

The existing LatestGeneration strategy is ok if all you are interested in are the Leaf nodes of a hierarchy. Bu there are other scenarios whereyou would want to visit all directory nodes (which is the default behaviour of invoke-traversedirectory). So why do we a strategy for the default sceanrio? Well its because the strategy links the filtering into the traversal so in actual fact not all directories are invoked if there is an active filter. So the new strategy TraverseAllStrategy still needs to preview every visited directory to ensure that it paasses the filter.

plastikfan commented 2 years ago

Might have to build a PolyDriver, which is similar to PolyFilter, but for directories. But, this PolyDriver/PolyFilter thing looks like it pointing to a code smell. We should only need 1 Poly entity, that satisfies the needs of directories and files.

Perhaps we have a MultiFilter derived from FilterDriver. The MultiFilter takes a MultiHandler, which can contain multiple filters, but these filters are tied to [FilterScope]::Current.

TODO: Rename all Driver derivatives to be xxxDriver instead of xxxFilter because the latter is confusing.