mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
parent
04f5d40e57
commit
20f4e5de75
3 changed files with 29 additions and 7 deletions
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
<!-- next-header -->
|
||||
## [Unreleased] - ReleaseDate
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- Fix the prior `typos <file>` fix that broke all other forms
|
||||
- Extend the fix to other modes (`--dump-config`, etc)
|
||||
|
||||
## [1.0.5] - 2021-06-05
|
||||
|
||||
#### Bug Fixes
|
||||
|
|
|
@ -66,11 +66,13 @@ fn run_dump_config(args: &args::Args, output_path: &std::path::Path) -> proc_exi
|
|||
|
||||
let path = &args.path[0];
|
||||
let cwd = if path == std::path::Path::new("-") {
|
||||
global_cwd.as_path()
|
||||
global_cwd
|
||||
} else if path.is_file() {
|
||||
path.parent().unwrap()
|
||||
let mut cwd = path.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?;
|
||||
cwd.pop();
|
||||
cwd
|
||||
} else {
|
||||
path.as_path()
|
||||
path.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?
|
||||
};
|
||||
let cwd = cwd.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?;
|
||||
|
||||
|
@ -108,11 +110,13 @@ fn run_type_list(args: &args::Args) -> proc_exit::ExitResult {
|
|||
|
||||
let path = &args.path[0];
|
||||
let cwd = if path == std::path::Path::new("-") {
|
||||
global_cwd.as_path()
|
||||
global_cwd
|
||||
} else if path.is_file() {
|
||||
path.parent().unwrap()
|
||||
let mut cwd = path.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?;
|
||||
cwd.pop();
|
||||
cwd
|
||||
} else {
|
||||
path.as_path()
|
||||
path.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?
|
||||
};
|
||||
let cwd = cwd.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?;
|
||||
|
||||
|
@ -178,7 +182,7 @@ fn run_checks(
|
|||
cwd.pop();
|
||||
cwd
|
||||
} else {
|
||||
path.clone()
|
||||
path.canonicalize().with_code(proc_exit::Code::USAGE_ERR)?
|
||||
};
|
||||
|
||||
engine
|
||||
|
|
13
tests/cli.rs
13
tests/cli.rs
|
@ -29,3 +29,16 @@ fn test_file_failure() {
|
|||
cmd.arg("README.md");
|
||||
cmd.assert().code(2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_relative_dir_failure() {
|
||||
let mut cmd = Command::cargo_bin("typos").unwrap();
|
||||
cmd.arg(".");
|
||||
cmd.assert().code(2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_assumed_dir_failure() {
|
||||
let mut cmd = Command::cargo_bin("typos").unwrap();
|
||||
cmd.assert().code(2);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue