You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/07-workspace.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -350,14 +350,28 @@ mcpp searches upward from the current directory; if it finds an `mcpp.toml` cont
350
350
351
351
### 5.3 The `-p, --package` Option
352
352
353
-
`-p` works with `build`, `test`, `run`, and other commands to select the target member. Its value is either the last path segment of a member's directory name or the full relative path:
353
+
`-p` works with `build`, `test`, `run`, and other commands to select the target
354
+
member. Its value is resolved in one order, because the option names a
355
+
*package*:
356
+
357
+
1. a member's qualified name, `<namespace>.<name>` (only meaningful for a
358
+
member that declares a namespace);
359
+
2. otherwise, a member's bare `package.name` — refused, naming every match, if
360
+
two or more members share it;
361
+
3. otherwise, a member's path as written in `[workspace] members`, or its
362
+
directory's last segment (the historical spellings, kept as a fallback).
354
363
355
364
```bash
356
-
mcpp build -p server # matches apps/server
365
+
mcpp build -p server # matches apps/server (by directory or package name)
357
366
mcpp test -p core # matches libs/core
358
367
mcpp run -p server -- --port 8080
359
368
```
360
369
370
+
A value that is one member's package name and a different member's directory
371
+
selects the member named by the package, with a warning naming the other one —
372
+
the option promises a package, so an exact package-name match outranks a
373
+
directory that merely happens to share the spelling.
374
+
361
375
`--workspace` (on `build` and `test`) is the fan-out form: it acts on **every**
362
376
member. `mcpp test --workspace` reports each member separately and continues past a
363
377
failing member, exiting non-zero if any member failed — ideal as a single,
0 commit comments