hollasch / pathmatch

A directory/filename pattern match utility for the Windows command shell
MIT License
6 stars 3 forks source link

Add option to specify a list of include/exclude patterns #23

Open hollasch opened 7 years ago

hollasch commented 7 years ago

This is similar to the old Perforce enlistment maps, where you supply a list of patterns for inclusion and exclusion. For example:

projects/one/...
-.../obj/
-.../lib/
-.../*.log
projects/two/...
-.../out/

It needs to be decided whether exclusion patterns apply to the nearest prior inclusion pattern, or to all included entries at that point in the process.

hollasch commented 5 years ago

This should probably be implemented in two ways.

A file of include/exclude patterns, similar to a Perforce enlistment map

As above, one pattern per line, support comments (#, //, /* ... */). Exclusions are patterns prefixed with a - character, whitespace allowed around the -.

A command-line switch to specify exclusion patterns

For example, --exclude <pattern1> <pattern2> .... Perhaps support optional --match switch if you want to provide the exclusions first.

hollasch commented 3 weeks ago

An alternative is prefix a pattern with ! to denote an exclusion pattern.