Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'examples/walkdir.rs')
-rw-r--r--examples/walkdir.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/walkdir.rs b/examples/walkdir.rs
index 4497487..c64f4ad 100644
--- a/examples/walkdir.rs
+++ b/examples/walkdir.rs
@@ -20,6 +20,7 @@ Options:
--tree Show output as a tree.
--sort Sort the output.
-q, --ignore-errors Ignore errors.
+ -d, --depth Show directory's contents before the directory itself.
";
#[derive(Debug, RustcDecodable)]
@@ -33,6 +34,7 @@ struct Args {
flag_tree: bool,
flag_ignore_errors: bool,
flag_sort: bool,
+ flag_depth: bool,
}
macro_rules! wout { ($($tt:tt)*) => { {writeln!($($tt)*)}.unwrap() } }
@@ -51,6 +53,9 @@ fn main() {
if args.flag_sort {
walkdir = walkdir.sort_by(|a,b| a.cmp(b));
}
+ if args.flag_depth {
+ walkdir = walkdir.contents_first(true)
+ }
let it = walkdir.into_iter();
let mut out = io::BufWriter::new(io::stdout());
let mut eout = io::stderr();