diff options
author | NerdyPepper <[email protected]> | 2019-07-12 10:24:44 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-07-12 10:24:44 +0100 |
commit | 74d3b10a01321b34bd5e26ef456d6b4d201b062e (patch) | |
tree | 7b0e2b2c080298667a38b74de9fca7372cd4b14b /src/main.rs | |
parent | d1847724d79521443e661c50a5c69171910f823c (diff) |
improve output in non existent directories
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 0603cba..3096635 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -4,6 +4,7 @@ mod vcs; | |||
4 | mod venv; | 4 | mod venv; |
5 | 5 | ||
6 | use clap::{Arg, App}; | 6 | use clap::{Arg, App}; |
7 | use colored::*; | ||
7 | 8 | ||
8 | fn main() { | 9 | fn main() { |
9 | let matches = App::new("Pista") | 10 | let matches = App::new("Pista") |
@@ -29,7 +30,10 @@ fn main() { | |||
29 | } | 30 | } |
30 | 31 | ||
31 | fn pista(zsh: bool) -> String { | 32 | fn pista(zsh: bool) -> String { |
32 | let cwd = cwd::cwd(); | 33 | let cwd = match cwd::cwd() { |
34 | Some(c) => c, | ||
35 | None => "[directory does not exist]".color("red") | ||
36 | }; | ||
33 | let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); | 37 | let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); |
34 | let venv = venv::get_name(); | 38 | let venv = venv::get_name(); |
35 | let prompt_char = prompt_char::get_char(); | 39 | let prompt_char = prompt_char::get_char(); |
@@ -53,7 +57,10 @@ fn pista(zsh: bool) -> String { | |||
53 | } | 57 | } |
54 | 58 | ||
55 | fn pista_minimal(zsh: bool) -> String { | 59 | fn pista_minimal(zsh: bool) -> String { |
56 | let cwd = cwd::cwd(); | 60 | let cwd = match cwd::cwd() { |
61 | Some(c) => c, | ||
62 | None => "[directory does not exist]".color("red") | ||
63 | }; | ||
57 | let vcs_tuple = vcs::vcs_status(); | 64 | let vcs_tuple = vcs::vcs_status(); |
58 | let mut vcs_component = String::new(); | 65 | let mut vcs_component = String::new(); |
59 | if let Some((branch, status)) = vcs_tuple { | 66 | if let Some((branch, status)) = vcs_tuple { |