diff --git a/lsv/entry.v b/lsv/entry.v index e3bfa63..2485692 100644 --- a/lsv/entry.v +++ b/lsv/entry.v @@ -31,6 +31,14 @@ struct Entry { invalid bool // lstat could not access } +fn (a Entry) == (b Entry) bool { + return a.name == b.name +} + +fn (a Entry) < (b Entry) bool { + return a.name < b.name +} + fn get_entries(files []string, options Options) []Entry { mut entries := []Entry{cap: 50} diff --git a/lsv/filter.v b/lsv/filter.v index 3d8a890..ec5b5d4 100644 --- a/lsv/filter.v +++ b/lsv/filter.v @@ -1,3 +1,4 @@ +import arrays import time enum ByTime { @@ -31,7 +32,7 @@ fn filter(entries []Entry, options Options) []Entry { for glob in options.glob_match.split('|') { matched << filtered.filter(it.name.match_glob(glob)) } - filtered = matched.clone() + filtered = arrays.distinct(matched) } filtered = filter_time(filtered, options.time_before_modified, .before_modified)