cli: Fix exit code of parse subcommand

This commit is contained in:
Max Brunsfeld 2019-02-06 16:17:35 -08:00
parent ccbb8c1cce
commit af694b4c13
2 changed files with 9 additions and 4 deletions

View file

@ -118,6 +118,7 @@ fn run() -> error::Result<()> {
.into_iter()
.collect::<Vec<_>>();
let max_path_length = paths.iter().map(|p| p.chars().count()).max().unwrap();
let mut has_error = false;
for path in paths {
let path = Path::new(path);
let language =
@ -129,7 +130,7 @@ fn run() -> error::Result<()> {
eprintln!("No language found");
return Ok(());
};
parse::parse_file_at_path(
has_error |= parse::parse_file_at_path(
language,
path,
max_path_length,
@ -139,6 +140,10 @@ fn run() -> error::Result<()> {
debug_graph,
)?;
}
if has_error {
return Err(error::Error(String::new()));
}
}
Ok(())