summaryrefslogtreecommitdiffstats
path: root/src/modules/directory.rs
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-04-12 23:06:48 -0400
committerMatan Kushner <hello@matchai.me>2019-04-12 23:06:48 -0400
commit9d4492c313220ee128a49e01dd3580d22450cd04 (patch)
treeaa5434e10f114c1bde36b3554cace0bde26e3ec0 /src/modules/directory.rs
parentd62bb107f231c3d0ebf47b7c91f26348213d8386 (diff)
Make segments optionals
Diffstat (limited to 'src/modules/directory.rs')
-rw-r--r--src/modules/directory.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/directory.rs b/src/modules/directory.rs
index 6ea6f71c3..d62a41f67 100644
--- a/src/modules/directory.rs
+++ b/src/modules/directory.rs
@@ -15,7 +15,7 @@ use std::path::Path;
///
/// **Truncation**
/// Paths will be limited in length to `3` path components by default.
-pub fn segment(_: &ArgMatches) -> Segment {
+pub fn segment(_: &ArgMatches) -> Option<Segment> {
const HOME_SYMBOL: &str = "~";
const DIR_TRUNCATION_LENGTH: usize = 3;
const SECTION_COLOR: Color = Color::Cyan;
@@ -44,8 +44,9 @@ pub fn segment(_: &ArgMatches) -> Segment {
segment
.set_value(truncated_dir_string)
- .set_style(SECTION_COLOR.bold())
- .clone()
+ .set_style(SECTION_COLOR.bold());
+
+ Some(segment)
}
/// Get the root directory of a git repo