Ver Fonte

Rename attr to xattr

nwin há 11 anos atrás
pai
commit
3d587c4533
7 ficheiros alterados com 23 adições e 21 exclusões
  1. 6 6
      src/file.rs
  2. 1 1
      src/main.rs
  3. 8 6
      src/options.rs
  4. 4 4
      src/output/details.rs
  5. 4 4
      src/xattr/mod.rs
  6. 0 0
      src/xattr/xattr_darwin.rs
  7. 0 0
      src/xattr/xattr_other.rs

+ 6 - 6
src/file.rs

@@ -21,8 +21,8 @@ use column::Column::*;
 use dir::Dir;
 use filetype::HasType;
 use options::{SizeFormat, TimeType};
-use attr;
-use attr::Attribute;
+use xattr;
+use xattr::Attribute;
 
 /// This grey value is directly in between white and black, so it's guaranteed
 /// to show up on either backgrounded terminal.
@@ -41,7 +41,7 @@ pub struct File<'a> {
     pub ext:   Option<String>,
     pub path:  Path,
     pub stat:  io::FileStat,
-    pub attrs: Vec<Attribute>,
+    pub xattrs: Vec<Attribute>,
     pub this:  Option<Dir>,
 }
 
@@ -83,7 +83,7 @@ impl<'a> File<'a> {
             path:  path.clone(),
             dir:   parent,
             stat:  stat,
-            attrs: attr::llist(path).unwrap_or(Vec::new()),
+            xattrs: xattr::llist(path).unwrap_or(Vec::new()),
             name:  filename.to_string(),
             ext:   ext(filename.as_slice()),
             this:  this,
@@ -196,7 +196,7 @@ impl<'a> File<'a> {
                 path:  target_path.clone(),
                 dir:   self.dir,
                 stat:  stat,
-                attrs: attr::list(target_path).unwrap_or(Vec::new()),
+                xattrs: xattr::list(target_path).unwrap_or(Vec::new()),
                 name:  filename.to_string(),
                 ext:   ext(filename.as_slice()),
                 this:  None,
@@ -351,7 +351,7 @@ impl<'a> File<'a> {
     /// attribute or not. Also returns “ ” in case the attributes cannot be read
     /// for some reason.
     fn attribute_marker(&self) -> ANSIString {
-        if self.attrs.len() > 0 { Plain.paint("@") } else { Plain.paint(" ") }
+        if self.xattrs.len() > 0 { Plain.paint("@") } else { Plain.paint(" ") }
     }
 
     /// Generate the "rwxrwxrwx" permissions string, like how ls does it.

+ 1 - 1
src/main.rs

@@ -30,7 +30,7 @@ pub mod filetype;
 pub mod options;
 pub mod output;
 pub mod term;
-pub mod attr;
+pub mod xattr;
 
 struct Exa<'a> {
     count:   usize,

+ 8 - 6
src/options.rs

@@ -4,7 +4,7 @@ use column::Column;
 use column::Column::*;
 use output::{Grid, Details};
 use term::dimensions;
-use attr;
+use xattr;
 
 use std::ascii::AsciiExt;
 use std::cmp::Ordering;
@@ -45,7 +45,7 @@ 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() {
+        if xattr::feature_implemented() {
             opts.optflag("@", "extended",
                          "display extended attribute keys and sizes in long (-l) output"
             );  
@@ -226,7 +226,7 @@ impl View {
                         columns: try!(Columns::deduce(matches)),
                         header: matches.opt_present("header"),
                         tree: matches.opt_present("recurse"),
-                        ext_attr: attr::feature_implemented() && matches.opt_present("extended"),
+                        xattr: xattr::feature_implemented() && matches.opt_present("extended"),
                         filter: filter,
                 };
 
@@ -257,7 +257,7 @@ impl View {
         else if matches.opt_present("tree") {
             Err(Misfire::Useless("tree", false, "long"))
         }
-        else if attr::feature_implemented() && matches.opt_present("extended") {
+        else if xattr::feature_implemented() && matches.opt_present("extended") {
             Err(Misfire::Useless("extended", false, "long"))
         }
         else if matches.opt_present("oneline") {
@@ -564,8 +564,10 @@ mod test {
 
     #[test]
     fn extended_without_long() {
-        let opts = Options::getopts(&[ "--extended".to_string() ]);
-        assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long"))
+        if xattr::feature_implemented() {
+            let opts = Options::getopts(&[ "--extended".to_string() ]);
+            assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long"))
+        }
     }
 
     #[test]

+ 4 - 4
src/output/details.rs

@@ -1,5 +1,5 @@
 use column::{Alignment, Column, Cell};
-use attr::Attribute;
+use xattr::Attribute;
 use dir::Dir;
 use file::{File, GREY};
 use options::{Columns, FileFilter};
@@ -13,7 +13,7 @@ pub struct Details {
     pub columns: Columns,
     pub header: bool,
     pub tree: bool,
-    pub ext_attr: bool,
+    pub xattr: bool,
     pub filter: FileFilter,
 }
 
@@ -76,7 +76,7 @@ impl Details {
 
             print!("{}\n", row.name);
             
-            if self.ext_attr {
+            if self.xattr {
                 let width = row.attrs.iter().map(|a| a.name().len()).max().unwrap_or(0);
                 for attr in row.attrs.iter() {
                     let name = attr.name();
@@ -97,7 +97,7 @@ impl Details {
                 cells: columns.iter().map(|c| file.display(c, cache, locale)).collect(),
                 name:  file.file_name_view(),
                 last:  index == src.len() - 1,
-                attrs: file.attrs.clone(),
+                attrs: file.xattrs.clone(),
                 children: file.this.is_some(),
             };
 

+ 4 - 4
src/attr/mod.rs → src/xattr/mod.rs

@@ -1,10 +1,10 @@
 //! Extended attribute support
 #[cfg(target_os = "macos")]
-mod attr_darwin;
+mod xattr_darwin;
 #[cfg(target_os = "macos")]
-pub use self::attr_darwin::*;
+pub use self::xattr_darwin::*;
 #[cfg(not(target_os = "macos"))]
-mod attr_other;
+mod xattr_other;
 #[cfg(not(target_os = "macos"))]
-pub use self::attr_other::*;
+pub use self::xattr_other::*;
 

+ 0 - 0
src/attr/attr_darwin.rs → src/xattr/xattr_darwin.rs


+ 0 - 0
src/attr/attr_other.rs → src/xattr/xattr_other.rs