diff options
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/options.rs b/src/options.rs index f5166b0..f239de9 100644 --- a/src/options.rs +++ b/src/options.rs @@ -4,6 +4,7 @@ use column::Column; use column::Column::*; use output::{Grid, Details}; use term::dimensions; +use attr; use std::ascii::AsciiExt; use std::cmp::Ordering; @@ -44,6 +45,11 @@ impl Options { /// Call getopts on the given slice of command-line strings. pub fn getopts(args: &[String]) -> Result<(Options, Vec<String>), Misfire> { let mut opts = getopts::Options::new(); + if attr::feature_implemented() { + opts.optflag("@", "extended", + "display extended attribute keys and sizes in long (-l) output" + ); + } opts.optflag("1", "oneline", "display one entry per line"); opts.optflag("a", "all", "show dot-files"); opts.optflag("b", "binary", "use binary prefixes in file sizes"); @@ -220,6 +226,7 @@ impl View { columns: try!(Columns::deduce(matches)), header: matches.opt_present("header"), tree: matches.opt_present("recurse"), + ext_attr: matches.opt_present("extended"), filter: filter, }; @@ -250,6 +257,9 @@ impl View { else if matches.opt_present("tree") { Err(Misfire::Useless("tree", false, "long")) } + else if attr::feature_implemented() && matches.opt_present("extended") { + Err(Misfire::Useless("extended", false, "long")) + } else if matches.opt_present("oneline") { if matches.opt_present("across") { Err(Misfire::Useless("across", true, "oneline")) @@ -553,6 +563,12 @@ mod test { } #[test] + fn extended_without_long() { + let opts = Options::getopts(&[ "--extended".to_string() ]); + assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long")) + } + + #[test] fn tree_without_recurse() { let opts = Options::getopts(&[ "--tree".to_string() ]); assert_eq!(opts.unwrap_err(), Misfire::Useless("tree", false, "recurse")) |