Rollup merge of #91310 - hi-rustin:rustin-patch-rustdoc, r=jyn514
Add --out-dir flag for rustdoc part of https://github.com/rust-lang/rust/issues/91260 Add --out-dir flag for rustdoc and change the `-o` option to point to out-dir. I'm not quite sure if it should be stable, also I'm not sure if this parameter priority is appropriate? Or should I just refuse to pass both parameters at the same time? r? `@jyn514`
This commit is contained in:
commit
d8bb4d69db
11 changed files with 57 additions and 5 deletions
|
|
@ -504,8 +504,18 @@ impl Options {
|
|||
return Err(1);
|
||||
}
|
||||
|
||||
let output =
|
||||
matches.opt_str("o").map(|s| PathBuf::from(&s)).unwrap_or_else(|| PathBuf::from("doc"));
|
||||
let out_dir = matches.opt_str("out-dir").map(|s| PathBuf::from(&s));
|
||||
let output = matches.opt_str("output").map(|s| PathBuf::from(&s));
|
||||
let output = match (out_dir, output) {
|
||||
(Some(_), Some(_)) => {
|
||||
diag.struct_err("cannot use both 'out-dir' and 'output' at once").emit();
|
||||
return Err(1);
|
||||
}
|
||||
(Some(out_dir), None) => out_dir,
|
||||
(None, Some(output)) => output,
|
||||
(None, None) => PathBuf::from("doc"),
|
||||
};
|
||||
|
||||
let cfgs = matches.opt_strs("cfg");
|
||||
|
||||
let extension_css = matches.opt_str("e").map(|s| PathBuf::from(&s));
|
||||
|
|
|
|||
|
|
@ -278,7 +278,16 @@ fn opts() -> Vec<RustcOptGroup> {
|
|||
o.optopt("r", "input-format", "the input type of the specified file", "[rust]")
|
||||
}),
|
||||
stable("w", |o| o.optopt("w", "output-format", "the output type to write", "[html]")),
|
||||
stable("o", |o| o.optopt("o", "output", "where to place the output", "PATH")),
|
||||
stable("output", |o| {
|
||||
o.optopt(
|
||||
"",
|
||||
"output",
|
||||
"Which directory to place the output. \
|
||||
This option is deprecated, use --out-dir instead.",
|
||||
"PATH",
|
||||
)
|
||||
}),
|
||||
stable("o", |o| o.optopt("o", "out-dir", "which directory to place the output", "PATH")),
|
||||
stable("crate-name", |o| {
|
||||
o.optopt("", "crate-name", "specify the name of this crate", "NAME")
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue