Permalink
Browse files

Added error message when top level path not found. fixes #161

  • Loading branch information...
Aaronepower committed Oct 21, 2018
1 parent 6dd6b74 commit 7c8a6b9b622a14c6832feadcca52ac4e2ecabaf0
Showing with 39 additions and 37 deletions.
  1. +24 −34 Cargo.lock
  2. +15 −3 src/main.rs

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -37,8 +37,19 @@ fn main() -> Result<(), Box<Error>> {
}
}
let types = ::std::mem::replace(&mut cli.types, None);
languages.get_statistics(&cli.input(), cli.ignored_directories(), types);
{
let types = ::std::mem::replace(&mut cli.types, None);
let input = cli.input();
for path in &input {
if ::std::fs::metadata(path).is_err() {
eprintln!("Error: '{}' not found.", path);
process::exit(1);
}
}
languages.get_statistics(&input, cli.ignored_directories(), types);
}
if let Some(format) = cli.output {
print!("{}", format.print(languages).unwrap());
@@ -71,7 +82,8 @@ fn main() -> Result<(), Box<Error>> {
print_results(&mut stdout, &row, languages.iter(), cli.files)?
}
// If we're listing files there's already a trailing row so we don't want an extra one.
// If we're listing files there's already a trailing row so we don't want an
// extra one.
if !cli.files {
writeln!(stdout, "{}", row)?;
}

0 comments on commit 7c8a6b9

Please sign in to comment.