pather icon indicating copy to clipboard operation
pather copied to clipboard

Allow nested folders to be matched and parsed

Open BigRoy opened this issue 10 years ago • 0 comments

Goal

Implement a way to parse and list recursively where a single key can be matched to an arbitrary or predefined depth.

In a pattern like test/{nested}/foo allow both of the following to match:

paths = ['test/nest/one/two/foo',
         'test/one/foo']

Example

pather.ls("C:/test/{nested@nest(1, -1)}")

We'd need to decide on a way to define the allowed nesting depth within the pattern and keep it readable at the same time. In the above example I was thinking the @ symbol could be separator where everything behind it is read as a registered "resolver" method in pather returning an (additional?) regex pattern that must be matched.

This syntax could easily grow complex and is very specific so I'd be happy to see and discuss better alternatives.

BigRoy avatar Nov 23 '15 17:11 BigRoy