mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
fix(cli): Report more errors through report system
This commit is contained in:
parent
104ebdcb6b
commit
c927717f2d
1 changed files with 7 additions and 2 deletions
|
@ -696,10 +696,15 @@ fn walk_entry(
|
|||
let explicit = entry.depth() == 0;
|
||||
let (path, lookup_path) = if entry.is_stdin() {
|
||||
let path = std::path::Path::new("-");
|
||||
(path, std::env::current_dir()?)
|
||||
let cwd = std::env::current_dir().map_err(|err| {
|
||||
let kind = err.kind();
|
||||
std::io::Error::new(kind, "no current working directory".to_owned())
|
||||
})?;
|
||||
(path, cwd)
|
||||
} else {
|
||||
let path = entry.path();
|
||||
(path, path.canonicalize()?)
|
||||
let abs_path = report_result(path.canonicalize(), Some(path), reporter)?;
|
||||
(path, abs_path)
|
||||
};
|
||||
let policy = engine.policy(&lookup_path);
|
||||
checks.check_file(path, explicit, &policy, reporter)?;
|
||||
|
|
Loading…
Reference in a new issue