diff options
author | Ben S <ogham@bsago.me> | 2015-08-25 18:29:23 +0100 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-08-25 18:29:23 +0100 |
commit | a250f21282b54d7ce7856057539ff667411d43f7 (patch) | |
tree | bda3418312ffef2a09f724041571cdf46fb112af /src/options.rs | |
parent | e523520b5653f65acf5e0c5266eaa34f6b3cea8f (diff) |
Coalesce platform-specific xattr modules
Now we have one Ur-module that contains functionality common to both supported platforms.
The benefits of doing it this way are that:
1. It doesn't implement a dummy interface - rather, there will be less code generated when the feature is not present;
2. The code shared between them can be kept in sync. The other two modules were something like 80% the same.
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/options.rs b/src/options.rs index 3a53343..d88eee5 100644 --- a/src/options.rs +++ b/src/options.rs @@ -11,7 +11,7 @@ use colours::Colours; use column::Column; use column::Column::*; use dir::Dir; -use feature::Attribute; +use feature::xattr; use file::File; use output::{Grid, Details, GridDetails, Lines}; use term::dimensions; @@ -62,7 +62,7 @@ impl Options { opts.optflag("", "git", "show git status"); } - if Attribute::feature_implemented() { + if xattr::ENABLED { opts.optflag("@", "extended", "display extended attribute keys and sizes in long (-l) output"); } @@ -281,7 +281,7 @@ impl View { columns: Some(try!(Columns::deduce(matches))), header: matches.opt_present("header"), recurse: dir_action.recurse_options().map(|o| (o, filter)), - xattr: Attribute::feature_implemented() && matches.opt_present("extended"), + xattr: xattr::ENABLED && matches.opt_present("extended"), colours: if dimensions().is_some() { Colours::colourful() } else { Colours::plain() }, }; @@ -302,7 +302,7 @@ impl View { else if matches.opt_present("level") && !matches.opt_present("recurse") && !matches.opt_present("tree") { Err(Useless2("level", "recurse", "tree")) } - else if Attribute::feature_implemented() && matches.opt_present("extended") { + else if xattr::ENABLED && matches.opt_present("extended") { Err(Useless("extended", false, "long")) } else { @@ -640,7 +640,7 @@ impl Columns { mod test { use super::Options; use super::Misfire; - use feature::Attribute; + use feature::xattr; fn is_helpful<T>(misfire: Result<T, Misfire>) -> bool { match misfire { @@ -742,7 +742,7 @@ mod test { #[test] fn extended_without_long() { - if Attribute::feature_implemented() { + if xattr::ENABLED { let opts = Options::getopts(&[ "--extended".to_string() ]); assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long")) } |