summaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-02-24 16:05:25 +0000
committerBen S <ogham@bsago.me>2015-02-24 16:05:25 +0000
commitf505bdc869728094e3d9109a5c6f1ae046c66663 (patch)
tree0ba41c2b80edd43fee32575f28d1891c7c613829 /src/output
parent0cb721a64432f5e4bb33c1b148ec81a42584099e (diff)
Add --level option to limit tree and recursion
Diffstat (limited to 'src/output')
-rw-r--r--src/output/details.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/output/details.rs b/src/output/details.rs
index 106c769..76df7bc 100644
--- a/src/output/details.rs
+++ b/src/output/details.rs
@@ -2,7 +2,7 @@ use column::{Alignment, Column, Cell};
use xattr::Attribute;
use dir::Dir;
use file::{File, GREY};
-use options::{Columns, FileFilter};
+use options::{Columns, FileFilter, RecurseOptions};
use users::OSUsers;
use locale;
@@ -12,7 +12,7 @@ use ansi_term::Style::Plain;
pub struct Details {
pub columns: Columns,
pub header: bool,
- pub tree: bool,
+ pub recurse: Option<RecurseOptions>,
pub xattr: bool,
pub filter: FileFilter,
}
@@ -57,7 +57,7 @@ impl Details {
print!("{} ", column.alignment().pad_string(&row.cells[num].text, padding));
}
- if self.tree {
+ if self.recurse.is_some() {
stack.resize(row.depth + 1, "├──");
stack[row.depth] = if row.last { "└──" } else { "├──" };
@@ -75,7 +75,7 @@ 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() {
@@ -103,7 +103,11 @@ impl Details {
dest.push(row);
- if self.tree {
+ if let Some(r) = self.recurse {
+ if r.tree == false || r.is_too_deep(depth) {
+ continue;
+ }
+
if let Some(ref dir) = file.this {
let mut files = dir.files(true);
self.filter.transform_files(&mut files);