mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-05 20:37:52 +00:00
Rename attr to xattr
This commit is contained in:
parent
227ddc9a0c
commit
3d587c4533
12
src/file.rs
12
src/file.rs
@ -21,8 +21,8 @@ use column::Column::*;
|
|||||||
use dir::Dir;
|
use dir::Dir;
|
||||||
use filetype::HasType;
|
use filetype::HasType;
|
||||||
use options::{SizeFormat, TimeType};
|
use options::{SizeFormat, TimeType};
|
||||||
use attr;
|
use xattr;
|
||||||
use attr::Attribute;
|
use xattr::Attribute;
|
||||||
|
|
||||||
/// This grey value is directly in between white and black, so it's guaranteed
|
/// This grey value is directly in between white and black, so it's guaranteed
|
||||||
/// to show up on either backgrounded terminal.
|
/// to show up on either backgrounded terminal.
|
||||||
@ -41,7 +41,7 @@ pub struct File<'a> {
|
|||||||
pub ext: Option<String>,
|
pub ext: Option<String>,
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub stat: io::FileStat,
|
pub stat: io::FileStat,
|
||||||
pub attrs: Vec<Attribute>,
|
pub xattrs: Vec<Attribute>,
|
||||||
pub this: Option<Dir>,
|
pub this: Option<Dir>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ impl<'a> File<'a> {
|
|||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
dir: parent,
|
dir: parent,
|
||||||
stat: stat,
|
stat: stat,
|
||||||
attrs: attr::llist(path).unwrap_or(Vec::new()),
|
xattrs: xattr::llist(path).unwrap_or(Vec::new()),
|
||||||
name: filename.to_string(),
|
name: filename.to_string(),
|
||||||
ext: ext(filename.as_slice()),
|
ext: ext(filename.as_slice()),
|
||||||
this: this,
|
this: this,
|
||||||
@ -196,7 +196,7 @@ impl<'a> File<'a> {
|
|||||||
path: target_path.clone(),
|
path: target_path.clone(),
|
||||||
dir: self.dir,
|
dir: self.dir,
|
||||||
stat: stat,
|
stat: stat,
|
||||||
attrs: attr::list(target_path).unwrap_or(Vec::new()),
|
xattrs: xattr::list(target_path).unwrap_or(Vec::new()),
|
||||||
name: filename.to_string(),
|
name: filename.to_string(),
|
||||||
ext: ext(filename.as_slice()),
|
ext: ext(filename.as_slice()),
|
||||||
this: None,
|
this: None,
|
||||||
@ -351,7 +351,7 @@ impl<'a> File<'a> {
|
|||||||
/// attribute or not. Also returns “ ” in case the attributes cannot be read
|
/// attribute or not. Also returns “ ” in case the attributes cannot be read
|
||||||
/// for some reason.
|
/// for some reason.
|
||||||
fn attribute_marker(&self) -> ANSIString {
|
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.
|
/// Generate the "rwxrwxrwx" permissions string, like how ls does it.
|
||||||
|
@ -30,7 +30,7 @@ pub mod filetype;
|
|||||||
pub mod options;
|
pub mod options;
|
||||||
pub mod output;
|
pub mod output;
|
||||||
pub mod term;
|
pub mod term;
|
||||||
pub mod attr;
|
pub mod xattr;
|
||||||
|
|
||||||
struct Exa<'a> {
|
struct Exa<'a> {
|
||||||
count: usize,
|
count: usize,
|
||||||
|
@ -4,7 +4,7 @@ use column::Column;
|
|||||||
use column::Column::*;
|
use column::Column::*;
|
||||||
use output::{Grid, Details};
|
use output::{Grid, Details};
|
||||||
use term::dimensions;
|
use term::dimensions;
|
||||||
use attr;
|
use xattr;
|
||||||
|
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
@ -45,7 +45,7 @@ impl Options {
|
|||||||
/// Call getopts on the given slice of command-line strings.
|
/// Call getopts on the given slice of command-line strings.
|
||||||
pub fn getopts(args: &[String]) -> Result<(Options, Vec<String>), Misfire> {
|
pub fn getopts(args: &[String]) -> Result<(Options, Vec<String>), Misfire> {
|
||||||
let mut opts = getopts::Options::new();
|
let mut opts = getopts::Options::new();
|
||||||
if attr::feature_implemented() {
|
if xattr::feature_implemented() {
|
||||||
opts.optflag("@", "extended",
|
opts.optflag("@", "extended",
|
||||||
"display extended attribute keys and sizes in long (-l) output"
|
"display extended attribute keys and sizes in long (-l) output"
|
||||||
);
|
);
|
||||||
@ -226,7 +226,7 @@ impl View {
|
|||||||
columns: try!(Columns::deduce(matches)),
|
columns: try!(Columns::deduce(matches)),
|
||||||
header: matches.opt_present("header"),
|
header: matches.opt_present("header"),
|
||||||
tree: matches.opt_present("recurse"),
|
tree: matches.opt_present("recurse"),
|
||||||
ext_attr: attr::feature_implemented() && matches.opt_present("extended"),
|
xattr: xattr::feature_implemented() && matches.opt_present("extended"),
|
||||||
filter: filter,
|
filter: filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ impl View {
|
|||||||
else if matches.opt_present("tree") {
|
else if matches.opt_present("tree") {
|
||||||
Err(Misfire::Useless("tree", false, "long"))
|
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"))
|
Err(Misfire::Useless("extended", false, "long"))
|
||||||
}
|
}
|
||||||
else if matches.opt_present("oneline") {
|
else if matches.opt_present("oneline") {
|
||||||
@ -564,9 +564,11 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn extended_without_long() {
|
fn extended_without_long() {
|
||||||
|
if xattr::feature_implemented() {
|
||||||
let opts = Options::getopts(&[ "--extended".to_string() ]);
|
let opts = Options::getopts(&[ "--extended".to_string() ]);
|
||||||
assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long"))
|
assert_eq!(opts.unwrap_err(), Misfire::Useless("extended", false, "long"))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn tree_without_recurse() {
|
fn tree_without_recurse() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use column::{Alignment, Column, Cell};
|
use column::{Alignment, Column, Cell};
|
||||||
use attr::Attribute;
|
use xattr::Attribute;
|
||||||
use dir::Dir;
|
use dir::Dir;
|
||||||
use file::{File, GREY};
|
use file::{File, GREY};
|
||||||
use options::{Columns, FileFilter};
|
use options::{Columns, FileFilter};
|
||||||
@ -13,7 +13,7 @@ pub struct Details {
|
|||||||
pub columns: Columns,
|
pub columns: Columns,
|
||||||
pub header: bool,
|
pub header: bool,
|
||||||
pub tree: bool,
|
pub tree: bool,
|
||||||
pub ext_attr: bool,
|
pub xattr: bool,
|
||||||
pub filter: FileFilter,
|
pub filter: FileFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ impl Details {
|
|||||||
|
|
||||||
print!("{}\n", row.name);
|
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);
|
let width = row.attrs.iter().map(|a| a.name().len()).max().unwrap_or(0);
|
||||||
for attr in row.attrs.iter() {
|
for attr in row.attrs.iter() {
|
||||||
let name = attr.name();
|
let name = attr.name();
|
||||||
@ -97,7 +97,7 @@ impl Details {
|
|||||||
cells: columns.iter().map(|c| file.display(c, cache, locale)).collect(),
|
cells: columns.iter().map(|c| file.display(c, cache, locale)).collect(),
|
||||||
name: file.file_name_view(),
|
name: file.file_name_view(),
|
||||||
last: index == src.len() - 1,
|
last: index == src.len() - 1,
|
||||||
attrs: file.attrs.clone(),
|
attrs: file.xattrs.clone(),
|
||||||
children: file.this.is_some(),
|
children: file.this.is_some(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
//! Extended attribute support
|
//! Extended attribute support
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
mod attr_darwin;
|
mod xattr_darwin;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub use self::attr_darwin::*;
|
pub use self::xattr_darwin::*;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
mod attr_other;
|
mod xattr_other;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
pub use self::attr_other::*;
|
pub use self::xattr_other::*;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user