Skip to content

Commit 90c4b8a

Browse files
committed
Add ddoc for -i
1 parent 7e8bea0 commit 90c4b8a

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

src/dmd/cli.d

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,37 @@ dmd -cov -unittest myprog.d
314314
"same as -i=-std,-core,-etc,-object"
315315
),
316316
Option("i=[-]<pattern>,[-]<pattern>,...",
317-
"include/exclude imported modules whose name matches one of <pattern>"
317+
"include/exclude imported modules whose name matches one of <pattern>",
318+
q"{$(P Enables "include imports" mode, where the compiler will include imported
319+
modules in the compilation, as if they were given on the command line.)
320+
321+
$(P Determining which modules to include is based on a set of "module patterns".
322+
These patterns are optionally included after `-i=` as a comma separated list.
323+
A pattern matches any module whose fully qualified name starts with the pattern.
324+
The pattern `foo.bar` matches all modules in the `foo.bar` package, such as
325+
`foo.bar` itself, `foo.bar.baz` or even `foo.bar.package`. Note that each component
326+
of the fully qualified name must match completely, so the pattern `foo.bar` would
327+
not match a module named `foo.barx`.)
328+
329+
$(P The presence of the `-` prefix in a module pattern indicates that matching modules
330+
should be excluded from compilation. Patterns without this indicate that
331+
matching-modules should be included in compilation.)
332+
333+
$(P Along with the module patterns supplied, there is a standard set of exclusionary
334+
patterns that are always included:
335+
`-std,-core,-etc,-object`
336+
Note that these can be overriden (i.e. `-i=std,core,etc,object`).)
337+
338+
$(P In the case where a module matches multiple patterns, the patterns are prioritized
339+
by their component length, where more components means higher priority, i.e. `foo.bar.baz`
340+
has a higher priority `foo.bar`.)
341+
342+
$(P By default modules that don't match any pattern will be included. However, if at
343+
least one inclusionary pattern is given, then modules that don't match any pattern will
344+
be excluded. This behavior can be overriden by providing the `.` pattern to include by
345+
default or `-.` to exclude by deafult.)
346+
347+
$(P Note: multiple `-i=...` options are allowed, each one adds more patterns.)}"
318348
),
319349
Option("ignore",
320350
"ignore unsupported pragmas"

0 commit comments

Comments
 (0)