|
@@ -69,7 +69,7 @@ impl Options {
|
|
|
|
|
|
|
|
// Filtering and sorting options
|
|
// Filtering and sorting options
|
|
|
opts.optflag("", "group-directories-first", "sort directories before other files");
|
|
opts.optflag("", "group-directories-first", "sort directories before other files");
|
|
|
- opts.optflag("a", "all", "don't hide hidden and 'dot' files");
|
|
|
|
|
|
|
+ opts.optflagmulti("a", "all", "don't hide hidden and 'dot' files");
|
|
|
opts.optflag("d", "list-dirs", "list directories like regular files");
|
|
opts.optflag("d", "list-dirs", "list directories like regular files");
|
|
|
opts.optopt ("L", "level", "limit the depth of recursion", "DEPTH");
|
|
opts.optopt ("L", "level", "limit the depth of recursion", "DEPTH");
|
|
|
opts.optflag("r", "reverse", "reverse the sert order");
|
|
opts.optflag("r", "reverse", "reverse the sert order");
|
|
@@ -145,6 +145,7 @@ impl Options {
|
|
|
#[cfg(test)]
|
|
#[cfg(test)]
|
|
|
mod test {
|
|
mod test {
|
|
|
use super::{Options, Misfire, SortField, SortCase};
|
|
use super::{Options, Misfire, SortField, SortCase};
|
|
|
|
|
+ use super::filter::DotFilter;
|
|
|
use fs::feature::xattr;
|
|
use fs::feature::xattr;
|
|
|
|
|
|
|
|
fn is_helpful<T>(misfire: Result<T, Misfire>) -> bool {
|
|
fn is_helpful<T>(misfire: Result<T, Misfire>) -> bool {
|
|
@@ -277,4 +278,24 @@ mod test {
|
|
|
let opts = Options::getopts(&[ "--level", "69105" ]);
|
|
let opts = Options::getopts(&[ "--level", "69105" ]);
|
|
|
assert_eq!(opts.unwrap_err(), Misfire::Useless2("level", "recurse", "tree"))
|
|
assert_eq!(opts.unwrap_err(), Misfire::Useless2("level", "recurse", "tree"))
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn nowt() {
|
|
|
|
|
+ let nothing: Vec<String> = Vec::new();
|
|
|
|
|
+ let dots = Options::getopts(¬hing).unwrap().0.filter.dot_filter;
|
|
|
|
|
+ assert_eq!(dots, DotFilter::JustFiles);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn all() {
|
|
|
|
|
+ let dots = Options::getopts(&[ "--all".to_string() ]).unwrap().0.filter.dot_filter;
|
|
|
|
|
+ assert_eq!(dots, DotFilter::ShowDotfiles);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn allall() {
|
|
|
|
|
+ let dots = Options::getopts(&[ "-a".to_string(), "-a".to_string() ]).unwrap().0.filter.dot_filter;
|
|
|
|
|
+ assert_eq!(dots, DotFilter::ShowDotfilesAndDots);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|