Doc: add chinese readme link (#347)

This commit is contained in:
yobrave 2018-10-20 04:05:15 +08:00 committed by David Peter
parent 437bd1188e
commit e2bb932f87
3 changed files with 36 additions and 54 deletions

View File

@ -2,6 +2,7 @@
[![Build Status](https://travis-ci.org/sharkdp/fd.svg?branch=master)](https://travis-ci.org/sharkdp/fd)
[![Build status](https://ci.appveyor.com/api/projects/status/21c4p5fwggc5gy3j?svg=true)](https://ci.appveyor.com/project/sharkdp/fd)
[![Version info](https://img.shields.io/crates/v/fd-find.svg)](https://crates.io/crates/fd-find)
[中文](https://github.com/chinanf-boy/fd-zh)
*fd* is a simple, fast and user-friendly alternative to
[*find*](https://www.gnu.org/software/findutils/).

View File

@ -42,61 +42,41 @@ mod tests {
use humantime;
let ref_time = humantime::parse_rfc3339("2010-10-10T10:10:10Z").unwrap();
assert!(
TimeFilter::after(&ref_time, "1min")
.unwrap()
.applies_to(&ref_time)
);
assert!(
!TimeFilter::before(&ref_time, "1min")
.unwrap()
.applies_to(&ref_time)
);
assert!(TimeFilter::after(&ref_time, "1min")
.unwrap()
.applies_to(&ref_time));
assert!(!TimeFilter::before(&ref_time, "1min")
.unwrap()
.applies_to(&ref_time));
let t1m_ago = ref_time - Duration::from_secs(60);
assert!(
!TimeFilter::after(&ref_time, "30sec")
.unwrap()
.applies_to(&t1m_ago)
);
assert!(
TimeFilter::after(&ref_time, "2min")
.unwrap()
.applies_to(&t1m_ago)
);
assert!(!TimeFilter::after(&ref_time, "30sec")
.unwrap()
.applies_to(&t1m_ago));
assert!(TimeFilter::after(&ref_time, "2min")
.unwrap()
.applies_to(&t1m_ago));
assert!(
TimeFilter::before(&ref_time, "30sec")
.unwrap()
.applies_to(&t1m_ago)
);
assert!(
!TimeFilter::before(&ref_time, "2min")
.unwrap()
.applies_to(&t1m_ago)
);
assert!(TimeFilter::before(&ref_time, "30sec")
.unwrap()
.applies_to(&t1m_ago));
assert!(!TimeFilter::before(&ref_time, "2min")
.unwrap()
.applies_to(&t1m_ago));
let t10s_before = "2010-10-10 10:10:00";
assert!(
!TimeFilter::before(&ref_time, t10s_before)
.unwrap()
.applies_to(&ref_time)
);
assert!(
TimeFilter::before(&ref_time, t10s_before)
.unwrap()
.applies_to(&t1m_ago)
);
assert!(!TimeFilter::before(&ref_time, t10s_before)
.unwrap()
.applies_to(&ref_time));
assert!(TimeFilter::before(&ref_time, t10s_before)
.unwrap()
.applies_to(&t1m_ago));
assert!(
TimeFilter::after(&ref_time, t10s_before)
.unwrap()
.applies_to(&ref_time)
);
assert!(
!TimeFilter::after(&ref_time, t10s_before)
.unwrap()
.applies_to(&t1m_ago)
);
assert!(TimeFilter::after(&ref_time, t10s_before)
.unwrap()
.applies_to(&ref_time));
assert!(!TimeFilter::after(&ref_time, t10s_before)
.unwrap()
.applies_to(&t1m_ago));
}
}

View File

@ -240,10 +240,11 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
if (!file_types.files && entry_type.is_file())
|| (!file_types.directories && entry_type.is_dir())
|| (!file_types.symlinks && entry_type.is_symlink())
|| (file_types.executables_only && !entry
.metadata()
.map(|m| fshelper::is_executable(&m))
.unwrap_or(false))
|| (file_types.executables_only
&& !entry
.metadata()
.map(|m| fshelper::is_executable(&m))
.unwrap_or(false))
|| (file_types.empty_only && !fshelper::is_empty(&entry))
{
return ignore::WalkState::Continue;