gjtorikian/nak — pull request #29 by benogle (2013-09-16 21:49:54+00:00)
Title: Add support for searching in a list of directories

tl;dr: Add path inclusions; use same code path as exclusions. Usage

```
node bin/nak -G 'subdir/, anotherdir' searchstring tests/search_fixtures/
node bin/nak -G '*.js, *.coffee' searchstring tests/search_fixtures/
```

* The `Ignorer` is now the `PathFilter`. It handles inclusion as well as exclusion.
* Inclusion is now handled by Minimatch.
* `fileSearch` option is now `pathInclude`, still used -G

Minimatch does not quite support the same syntax as `.gitignore`. As such, previously it was not quite working as expected. Some notable differences:

`.gitignore` Supports these things but `Minimatch` does not:
* `adir` will match `adir/anotherdir` (supported with this pull)
* `adir/` will match `adir/anotherdir` (supported with this pull)
* `anotherdir` will match `adir/anotherdir/somefile.txt` (not supported!)

Supporting these adds a bit of complexity. For each directory I encounter, I add 2 Minimatch patterns:

```
directory/anotherdir
directory/anotherdir/*
```

The first will match the literal directory during traversal, and the second will match a file or directory within the directory.