Skip to content

Commit 31847ee

Browse files
committed
Auto merge of #5081 - matklad:document-not-all-the-things, r=alexcrichton
Support --exclude option for `cargo doc` I think this should have been implemented when the feature was added for other commands. Probably just an oversight. cc #4031 r? @alexcrichton
2 parents cd2ae96 + 9816c95 commit 31847ee

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/bin/doc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct Options {
2727
flag_frozen: bool,
2828
flag_locked: bool,
2929
flag_all: bool,
30+
flag_exclude: Vec<String>,
3031
#[serde(rename = "flag_Z")]
3132
flag_z: Vec<String>,
3233
}
@@ -42,6 +43,7 @@ Options:
4243
--open Opens the docs in a browser after the operation
4344
-p SPEC, --package SPEC ... Package to document
4445
--all Document all packages in the workspace
46+
--exclude SPEC ... Exclude packages from the build
4547
--no-deps Don't build documentation for dependencies
4648
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
4749
--lib Document only this package's library
@@ -88,11 +90,9 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
8890
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
8991
let ws = Workspace::new(&root, config)?;
9092

91-
let spec = if options.flag_all || (ws.is_virtual() && options.flag_package.is_empty()) {
92-
Packages::All
93-
} else {
94-
Packages::Packages(&options.flag_package)
95-
};
93+
let spec = Packages::from_flags(options.flag_all,
94+
&options.flag_exclude,
95+
&options.flag_package)?;
9696

9797
let empty = Vec::new();
9898
let doc_opts = ops::DocOptions {

0 commit comments

Comments
 (0)