rename tools -> ra_tools

This should help with caching on CI I hope (see .travis.yml
before_cache)
This commit is contained in:
Aleksey Kladov
2019-06-11 01:47:37 +03:00
parent 75e6c03883
commit 10d34532e3
8 changed files with 25 additions and 27 deletions

View File

@@ -0,0 +1,28 @@
use std::process::Command;
use failure::bail;
use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite};
fn main() -> Result<()> {
run_rustfmt(Overwrite)?;
update_staged()
}
fn update_staged() -> Result<()> {
let root = project_root();
let output = Command::new("git")
.arg("diff")
.arg("--diff-filter=MAR")
.arg("--name-only")
.arg("--cached")
.current_dir(&root)
.output()?;
if !output.status.success() {
bail!("`git diff --diff-filter=MAR --name-only --cached` exited with {}", output.status);
}
for line in String::from_utf8(output.stdout)?.lines() {
run(&format!("git update-index --add {}", root.join(line).to_string_lossy()), ".")?;
}
Ok(())
}