ops::compile(&ws, &compile_opts)?;
return Ok(());
}
+ ("rustdoc", Some(args)) => {
+ let ws = workspace_from_args(config, args)?;
+ let mode = CompileMode::Doc { deps: false };
+ let mut compile_opts = compile_options_from_args(config, args, mode)?;
+ let packages = values(args, "package");
+ compile_opts.spec = Packages::Packages(&packages);
+ compile_opts.target_rustdoc_args = Some(&values(args, "args"));
+ let doc_opts = ops::DocOptions {
+ open_result: args.is_present("open"),
+ compile_opts
+ };
+ ops::doc(&ws, &doc_opts)?;
+ return Ok(());
+ }
_ => return Ok(())
}
}
read_manifest::cli(),
run::cli(),
rustc::cli(),
+ rustdoc::cli(),
])
;
app
mod read_manifest;
mod run;
mod rustc;
+mod rustdoc;
mod utils {
use clap::{self, SubCommand, AppSettings};
--- /dev/null
+use clap::AppSettings;
+
+use super::utils::*;
+
+pub fn cli() -> App {
+ subcommand("rustdoc")
+ .setting(AppSettings::TrailingVarArg)
+ .about("Build a package's documentation, using specified custom flags.")
+ .arg(Arg::with_name("args").multiple(true))
+ .arg(opt("open", "Opens the docs in a browser after the operation"))
+ .arg(
+ opt("package", "Package to document")
+ .short("p").value_name("SPEC")
+ )
+ .arg_jobs()
+ .arg_targets_all(
+ "Build only this package's library",
+ "Build only the specified binary",
+ "Build all binaries",
+ "Build only the specified example",
+ "Build all examples",
+ "Build only the specified test target",
+ "Build all tests",
+ "Build only the specified bench target",
+ "Build all benches",
+ "Build all targets (default)",
+ )
+ .arg_release("Build artifacts in release mode, with optimizations")
+ .arg_manifest_path()
+ .arg_message_format()
+ .after_help("\
+The specified target for the current package (or package specified by SPEC if
+provided) will be documented with the specified <opts>... being passed to the
+final rustdoc invocation. Dependencies will not be documented as part of this
+command. Note that rustdoc will still unconditionally receive arguments such
+as -L, --extern, and --crate-type, and the specified <opts>... will simply be
+added to the rustdoc invocation.
+
+If the --package argument is given, then SPEC is a package id specification
+which indicates which package should be documented. If it is not given, then the
+current package is documented. For more information on SPEC and its format, see
+the `cargo help pkgid` command.
+")
+}