summaryrefslogtreecommitdiffstats
path: root/src/dir.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-02-03 13:27:23 +0000
committerBen S <ogham@bsago.me>2015-02-03 13:27:23 +0000
commit5099b3f119fabde1cfb8db798af67af3589dd9af (patch)
tree0d0d6cd74c0aed07b3441f532515781821cabe19 /src/dir.rs
parent7acc1b09d50ba0bdafe9bbc08ec097e3074d8aa2 (diff)
Initial tree implementation
There's still a lot to do, but this is actually *something*. The tree hierarchy is displayed using hashes at the start of a line. I want to have it just before the filename, but this will need some changes to the way that columns are handled.
Diffstat (limited to 'src/dir.rs')
-rw-r--r--src/dir.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dir.rs b/src/dir.rs
index 8a567fd..e0a2f25 100644
--- a/src/dir.rs
+++ b/src/dir.rs
@@ -31,11 +31,14 @@ impl Dir {
/// Produce a vector of File objects from an initialised directory,
/// printing out an error if any of the Files fail to be created.
- pub fn files(&self) -> Vec<File> {
+ ///
+ /// Passing in `recurse` means that any directories will be scanned for
+ /// their contents, as well.
+ pub fn files(&self, recurse: bool) -> Vec<File> {
let mut files = vec![];
for path in self.contents.iter() {
- match File::from_path(path, Some(self)) {
+ match File::from_path(path, Some(self), recurse) {
Ok(file) => files.push(file),
Err(e) => println!("{}: {}", path.display(), e),
}