Listing scanned files
mago list-files prints the files Mago would touch given your current configuration. It is the fastest way to verify that paths, includes, and excludes are doing what you think they are doing.
Basic usage
mago list-files
This prints files from [source].paths, your project's own source code. Files from includes (typically vendor) are not shown because they are parsed for context, not analysed.
Tool-specific lists
Each tool (linter, formatter, analyzer, guard) has its own optional excludes that adds to the global one. Different tools therefore process different file sets. To see one tool's view:
mago list-files --command linter
mago list-files --command formatter
mago list-files --command analyzer
mago list-files --command guard
Example
Given this configuration:
[source]
paths = ["src", "tests"]
excludes = ["cache/**"] # excluded from every tool
[analyzer]
excludes = ["tests/**/*.php"] # additionally excluded from analysis
[formatter]
excludes = ["src/**/AutoGenerated/**"] # additionally excluded from formatting
The lists differ:
mago list-files # src/** + tests/**, minus cache/**
mago list-files --command analyzer # src/** only (tests excluded)
mago list-files --command formatter # src/** + tests/**, minus AutoGenerated files
Piping into other tools
Filenames can contain newlines. If you plan to feed the output to a tool like xargs, terminate filenames with NUL bytes instead:
mago list-files -0 | xargs -0r ls -l
Reference
Usage: mago list-files [OPTIONS]
| Flag | Description |
|---|---|
--command <COMMAND> | Apply a tool's exclude rules. Values: linter, formatter, analyzer, guard. |
-0, --zero-terminate | Terminate filenames with NUL instead of newline. |
-h, --help | Print help and exit. |
Global flags must come before list-files. See the CLI overview for the full list.