mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Move from bash to rust
This commit is contained in:
parent
4d44d77c4d
commit
25a3ffe5d4
@ -2390,22 +2390,39 @@ impl<'test> TestCx<'test> {
|
|||||||
proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
|
proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: this is fine since compiletest never runs out-of-tree
|
#[rustfmt::skip]
|
||||||
let tidy = concat!(env!("CARGO_MANIFEST_DIR"), "/tidy-rustdoc.sh");
|
let tidy_args = [
|
||||||
// FIXME: this overwrites `out_dir` in place, maybe we should make a copy?
|
"--indent", "yes",
|
||||||
let status = Command::new(tidy)
|
"--indent-spaces", "2",
|
||||||
.arg(out_dir)
|
"--wrap", "0",
|
||||||
.spawn()
|
"--show-warnings", "no",
|
||||||
.expect("tidy-rustdoc not found")
|
"--markup", "yes",
|
||||||
.wait()
|
"--quiet", "yes",
|
||||||
.unwrap();
|
"-modify",
|
||||||
if !status.success() {
|
];
|
||||||
self.fatal("failed to run tidy - is it installed?");
|
let tidy_dir = |dir| {
|
||||||
}
|
let tidy = |file: &_| {
|
||||||
let status = Command::new(tidy).arg(&compare_dir).spawn().unwrap().wait().unwrap();
|
Command::new("tidy")
|
||||||
if !status.success() {
|
.args(&tidy_args)
|
||||||
self.fatal("failed to run tidy");
|
.arg(file)
|
||||||
}
|
.spawn()
|
||||||
|
.unwrap_or_else(|err| {
|
||||||
|
self.fatal(&format!("failed to run tidy - is it installed? - {}", err))
|
||||||
|
})
|
||||||
|
.wait()
|
||||||
|
.unwrap()
|
||||||
|
};
|
||||||
|
for entry in walkdir::WalkDir::new(dir) {
|
||||||
|
let entry = entry.expect("failed to read file");
|
||||||
|
if entry.file_type().is_file()
|
||||||
|
&& entry.path().extension().and_then(|p| p.to_str()) == Some("html".into())
|
||||||
|
{
|
||||||
|
tidy(entry.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tidy_dir(out_dir);
|
||||||
|
tidy_dir(&compare_dir);
|
||||||
|
|
||||||
let pager = {
|
let pager = {
|
||||||
let output = Command::new("git").args(&["config", "--get", "core.pager"]).output().ok();
|
let output = Command::new("git").args(&["config", "--get", "core.pager"]).output().ok();
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
indir="${1:?Missing argument 1: input directory}"
|
|
||||||
|
|
||||||
tidy () {
|
|
||||||
command tidy \
|
|
||||||
--indent yes \
|
|
||||||
--indent-spaces 2 \
|
|
||||||
--wrap 0 \
|
|
||||||
--show-warnings no \
|
|
||||||
--markup yes \
|
|
||||||
--quiet yes \
|
|
||||||
"$@" \
|
|
||||||
>/dev/null \
|
|
||||||
|| [ $? -eq 1 ] # tidy exits with code 1 if there were any warnings
|
|
||||||
}
|
|
||||||
|
|
||||||
find "$indir" -type f -name '*.html' -print0 \
|
|
||||||
| while IFS= read -d '' -r file
|
|
||||||
do
|
|
||||||
tidy -modify "$file"
|
|
||||||
done
|
|
Loading…
Reference in New Issue
Block a user