diff options
author | Ben S <ogham@bsago.me> | 2015-02-23 14:52:07 +0000 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-02-23 14:52:07 +0000 |
commit | ce23c63d759e3f19f59c91ebaa776d5b7a8746ac (patch) | |
tree | 354dca32c27c2c63a3a7d03b3faef882d0a87f1f /src/output | |
parent | 38a785426bda54db3adeeb7edf991fd8c4d78e30 (diff) | |
parent | 586c7dd30b2091d2b9fa3dc53b0af0aa2feb0b0f (diff) |
Merge branch 'nwin:add-xattr-linux'
Conflicts:
src/file.rs
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/details.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/output/details.rs b/src/output/details.rs index 5ec4d5d..106c769 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -1,4 +1,5 @@ -use column::{Column, Cell}; +use column::{Alignment, Column, Cell}; +use xattr::Attribute; use dir::Dir; use file::{File, GREY}; use options::{Columns, FileFilter}; @@ -12,6 +13,7 @@ pub struct Details { pub columns: Columns, pub header: bool, pub tree: bool, + pub xattr: bool, pub filter: FileFilter, } @@ -36,6 +38,7 @@ impl Details { cells: columns.iter().map(|c| Cell::paint(Plain.underline(), c.header())).collect(), name: Plain.underline().paint("Name").to_string(), last: false, + attrs: Vec::new(), children: false, }; @@ -72,6 +75,17 @@ impl Details { } print!("{}\n", row.name); + + 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(); + println!("{}\t{}", + Alignment::Left.pad_string(name, width - name.len()), + attr.size() + ) + } + } } } @@ -83,6 +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.xattrs.clone(), children: file.this.is_some(), }; @@ -104,6 +119,7 @@ struct Row { pub cells: Vec<Cell>, pub name: String, pub last: bool, + pub attrs: Vec<Attribute>, pub children: bool, } |