]> git.proxmox.com Git - cargo.git/blame - src/bin/cargo/commands/rustdoc.rs
Unify the description of quiet flag
[cargo.git] / src / bin / cargo / commands / rustdoc.rs
CommitLineData
293a2a7f 1use cargo::ops::{self, DocOptions};
6b9c063b 2
f7c91ba6
AR
3use crate::command_prelude::*;
4
ecb5b15f
AK
5pub fn cli() -> App {
6 subcommand("rustdoc")
7 .setting(AppSettings::TrailingVarArg)
8 .about("Build a package's documentation, using specified custom flags.")
17c0ea74 9 .arg(opt("quiet", "Do not print cargo log messages").short("q"))
ecb5b15f 10 .arg(Arg::with_name("args").multiple(true))
1e682848
AC
11 .arg(opt(
12 "open",
13 "Opens the docs in a browser after the operation",
14 ))
70ff33a5 15 .arg_package("Package to document")
ecb5b15f
AK
16 .arg_jobs()
17 .arg_targets_all(
18 "Build only this package's library",
19 "Build only the specified binary",
20 "Build all binaries",
21 "Build only the specified example",
22 "Build all examples",
23 "Build only the specified test target",
24 "Build all tests",
25 "Build only the specified bench target",
26 "Build all benches",
3a1cad6f 27 "Build all targets",
ecb5b15f
AK
28 )
29 .arg_release("Build artifacts in release mode, with optimizations")
86c459d4 30 .arg_profile("Build artifacts with the specified profile")
31e6c968 31 .arg_features()
a118cdb1 32 .arg_target_triple("Build for the target triple")
dd0b7a2c 33 .arg_target_dir()
ecb5b15f
AK
34 .arg_manifest_path()
35 .arg_message_format()
aa80a984 36 .arg_unit_graph()
c221fec9 37 .arg_ignore_rust_version()
0e26eae5 38 .after_help("Run `cargo help rustdoc` for more detailed information.\n")
ecb5b15f 39}
6b9c063b 40
6d1d3a68 41pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
6b9c063b 42 let ws = args.workspace(config)?;
db09895f 43 let mut compile_opts = args.compile_options_for_single_package(
44 config,
45 CompileMode::Doc { deps: false },
46 Some(&ws),
73dba767 47 ProfileChecking::Custom,
db09895f 48 )?;
3e07a3e6
XL
49 let target_args = values(args, "args");
50 compile_opts.target_rustdoc_args = if target_args.is_empty() {
51 None
52 } else {
53 Some(target_args)
54 };
6b9c063b
AK
55 let doc_opts = DocOptions {
56 open_result: args.is_present("open"),
57 compile_opts,
58 };
59 ops::doc(&ws, &doc_opts)?;
60 Ok(())
61}