Skip to content

Commit 8f9014d

Browse files
Rename rustdoc options --themes and --check-themes to --theme and --check-theme
1 parent 685b63a commit 8f9014d

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

src/doc/rustdoc/src/command-line-arguments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,19 +359,19 @@ This flag allows `rustdoc` to treat your rust code as the given edition. It will
359359
the given edition as well. As with `rustc`, the default edition that `rustdoc` will use is `2015`
360360
(the first edition).
361361

362-
## `themes`: add more themes to generated documentation
362+
## `theme`: add more themes to generated documentation
363363

364364
By default, `rustdoc` only provides the "dark" and "light" themes. If you want to add new ones,
365365
you'll need to use this flag as follows:
366366

367367
```bash
368-
$ rustdoc src/lib.rs --themes /path/to/your/theme/file.css
368+
$ rustdoc src/lib.rs --theme /path/to/your/theme/file.css
369369
```
370370

371371
Note that the theme's name will be the file name without its extension. So if you pass
372372
`/path/to/your/theme/file.css` as theme, then the theme's name will be `file`.
373373

374-
### `check-themes`: check if your themes implement all the required rules
374+
### `check-theme`: check if your themes implement all the required rules
375375

376376
This flag allows you to check if your themes implement the necessary CSS rules. To put it more
377377
simply, when adding a new theme, it needs to implements all the CSS rules present in the "light"
@@ -380,5 +380,5 @@ CSS theme.
380380
You can use this flag like this:
381381

382382
```bash
383-
$ rustdoc --check-themes /path/to/your/theme/file.css
383+
$ rustdoc --check-theme /path/to/your/theme/file.css
384384
```

src/librustdoc/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ impl Options {
282282
// check for deprecated options
283283
check_deprecated_options(&matches, &diag);
284284

285-
let to_check = matches.opt_strs("check-themes");
285+
let to_check = matches.opt_strs("check-theme");
286286
if !to_check.is_empty() {
287287
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
288288
let mut errors = 0;
289289

290-
println!("rustdoc: [check-themes] Starting tests! (Ignoring all other arguments)");
290+
println!("rustdoc: [check-theme] Starting tests! (Ignoring all other arguments)");
291291
for theme_file in to_check.iter() {
292292
print!(" - Checking \"{}\"...", theme_file);
293293
let (success, differences) = theme::test_theme_against(theme_file, &paths, &diag);
@@ -358,15 +358,15 @@ impl Options {
358358
}
359359

360360
let mut themes = Vec::new();
361-
if matches.opt_present("themes") {
361+
if matches.opt_present("theme") {
362362
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
363363

364-
for (theme_file, theme_s) in matches.opt_strs("themes")
364+
for (theme_file, theme_s) in matches.opt_strs("theme")
365365
.iter()
366366
.map(|s| (PathBuf::from(&s), s.to_owned())) {
367367
if !theme_file.is_file() {
368368
diag.struct_err(&format!("invalid file: \"{}\"", theme_s))
369-
.help("option --themes arguments must all be files")
369+
.help("option --theme arguments must all be files")
370370
.emit();
371371
return Err(1);
372372
}
@@ -384,7 +384,7 @@ impl Options {
384384
default theme", theme_s))
385385
.warn("the theme may appear incorrect when loaded")
386386
.help(&format!("to see what rules are missing, call `rustdoc \
387-
--check-themes \"{}\"`", theme_s))
387+
--check-theme \"{}\"`", theme_s))
388388
.emit();
389389
}
390390
themes.push(theme_file);

src/librustdoc/html/static_files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub static RUST_FAVICON: &'static [u8] = include_bytes!("static/favicon.ico");
5959
/// The built-in themes given to every documentation site.
6060
pub mod themes {
6161
/// The "light" theme, selected by default when no setting is available. Used as the basis for
62-
/// the `--check-themes` functionality.
62+
/// the `--check-theme` functionality.
6363
pub static LIGHT: &'static str = include_str!("static/themes/light.css");
6464

6565
/// The "dark" theme.

src/librustdoc/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ fn opts() -> Vec<RustcOptGroup> {
251251
o.optflag("", "sort-modules-by-appearance", "sort modules by where they appear in the \
252252
program, rather than alphabetically")
253253
}),
254-
stable("themes", |o| {
255-
o.optmulti("", "themes",
254+
stable("theme", |o| {
255+
o.optmulti("", "theme",
256256
"additional themes which will be added to the generated docs",
257257
"FILES")
258258
}),
259-
stable("check-themes", |o| {
260-
o.optmulti("", "check-themes",
259+
stable("check-theme", |o| {
260+
o.optmulti("", "check-theme",
261261
"check if given theme is valid",
262262
"FILES")
263263
}),

src/test/run-make-fulldeps/rustdoc-themes/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes"
66

77
all:
88
cp $(S)/src/librustdoc/html/static/themes/light.css $(TMPDIR)/test.css
9-
$(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --themes $(TMPDIR)/test.css
9+
$(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css
1010
$(HTMLDOCCK) $(OUTPUT_DIR) foo.rs

src/tools/rustdoc-themes/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ fn main() {
3838
eprintln!("No theme found in \"{}\"...", themes_folder);
3939
exit(1);
4040
}
41+
let arg_name = "--check-theme".to_owned();
4142
let status = Command::new(rustdoc_bin)
42-
.args(&["-Z", "unstable-options", "--check-themes"])
43-
.args(&themes)
43+
.args(&["-Z", "unstable-options"])
44+
.args(&themes.iter()
45+
.flat_map(|t| vec![&arg_name, t].into_iter())
46+
.collect::<Vec<_>>())
4447
.status()
4548
.expect("failed to execute child");
4649
if !status.success() {

0 commit comments

Comments
 (0)