4.3.3 Common Candidate Generators: FILESYSTEM

The remainder of the candidate generator section will cover the candidate generators that come packaged in p-search. The most prominent one is the filesystem candidate generator. p-search defaults to creating this in a variety of situations. The candidate generator makes a document for each file in a directory. You will be prompted for the following arguments when creating a filesystem candidate generator:

d Directory

The directory from which all candidates will be produced.

f Filename Pattern

A regular expression that all candidate files must match. Use “.*” to match all files.

t Search Tool

The CLI tool used to perform the term frequency search. At the moment, the filesystem candidate generator supports the tools ripgrep (recommended), ag, and grep. These tools will be used when creating a “text query” prior.

-i Ignore Pattern

A regular expression which can be provided to specify files not to match.

-g Git ls-files

Use the command git ls-files to enumerate the candidates. If your directory is a Git repository, it is strongly recommended that you turn this setting on to ignore files not committed to git. Having this option set to false would result in p-search attempting to search all vendored directories like node_modules, which could make the search very slow.

Note how required inputs in the transient menu are letters while the options all begin with a dash.