summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Lichtman <aaronlichtman@gmail.com>2019-07-20 19:29:44 -0500
committerPierre Peltier <dev@halium.fr>2019-09-02 15:04:03 +0200
commit66eb8532c206f520334dd3c2f03c04c00b3fe838 (patch)
tree1ec85b598a31c0b336f99d02d1ff16bd7425b225
parentaa40bd28219b9c175bf18c8272f6c294984125a0 (diff)
Add indent flag.
Fix #22. For some reason this breaks file icon rendering?
-rw-r--r--src/app.rs7
-rw-r--r--src/display.rs5
-rw-r--r--src/flags.rs3
3 files changed, 15 insertions, 0 deletions
diff --git a/src/app.rs b/src/app.rs
index c386265..accc5cb 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -54,6 +54,13 @@ pub fn build() -> App<'static, 'static> {
.help("Whether to use fancy or unicode icons"),
)
.arg(
+ Arg::with_name("indent")
+ .short("i")
+ .long("indent")
+ .multiple(false)
+ .help("Add tab indent before file and directory names in output"),
+ )
+ .arg(
Arg::with_name("indicators")
.short("F")
.long("classify")
diff --git a/src/display.rs b/src/display.rs
index 3c81eb2..b1d421e 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -74,6 +74,11 @@ fn inner_display_one_line(
continue;
}
+ // TODO: Figure out why this breaks file icon rendering.
+ if flags.indent {
+ output.push_str(" ");
+ }
+
if let Layout::OneLine { long: true } = flags.layout {
output += &get_long_output(&meta, &colors, &icons, &flags, padding_rules.unwrap());
} else {
diff --git a/src/flags.rs b/src/flags.rs
index 790b554..388db00 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -12,6 +12,7 @@ pub struct Flags {
pub size: SizeFlag,
pub date: DateFlag,
pub color: WhenFlag,
+ pub indent: bool,
pub icon: WhenFlag,
pub icon_theme: IconTheme,
pub recursion_depth: usize,
@@ -115,6 +116,7 @@ impl Flags {
} else {
WhenFlag::from(color_inputs[color_inputs.len() - 1])
},
+ indent: matches.is_present("indent"),
icon: if classic_mode {
WhenFlag::Never
} else {
@@ -146,6 +148,7 @@ impl Default for Flags {
size: SizeFlag::Default,
date: DateFlag::Date,
color: WhenFlag::Auto,
+ indent: false,
icon: WhenFlag::Auto,
icon_theme: IconTheme::Fancy,
blocks: vec![