diff options
-rw-r--r-- | src/prompt_char.rs | 12 | ||||
-rw-r--r-- | src/vcs.rs | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/prompt_char.rs b/src/prompt_char.rs index 1df4c5d..a95681e 100644 --- a/src/prompt_char.rs +++ b/src/prompt_char.rs | |||
@@ -1,14 +1,16 @@ | |||
1 | use std::env; | 1 | use std::env; |
2 | use colored::*; | 2 | use colored::*; |
3 | 3 | ||
4 | pub fn prompt_char() -> colored::ColoredString { | 4 | pub fn get_char() -> colored::ColoredString { |
5 | let user_char = env::var("PROMPT_CHAR").unwrap_or("$ ".into()); | 5 | let user_char = env::var("PROMPT_CHAR").unwrap_or("$".into()); |
6 | let root_char = env::var("PROMPT_CHAR_ROOT").unwrap_or("# ".into()); | 6 | let root_char = env::var("PROMPT_CHAR_ROOT").unwrap_or("#".into()); |
7 | let user_char_color = env::var("PROMPT_CHAR_COLOR").unwrap_or("green ".into()); | ||
8 | let root_char_color = env::var("PROMPT_CHAR_ROOT_COLOR").unwrap_or("red".into()); | ||
7 | 9 | ||
8 | let euid = unsafe { libc::geteuid() }; | 10 | let euid = unsafe { libc::geteuid() }; |
9 | match euid { | 11 | match euid { |
10 | 0 => return root_char.red(), | 12 | 0 => return root_char.color(root_char_color), |
11 | _ => return user_char.green() | 13 | _ => return user_char.color(user_char_color) |
12 | } | 14 | } |
13 | } | 15 | } |
14 | 16 | ||
@@ -5,7 +5,7 @@ use colored::*; | |||
5 | 5 | ||
6 | pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)> { | 6 | pub fn vcs_status() -> Option<(colored::ColoredString, colored::ColoredString)> { |
7 | let current_dir = env::var("PWD").unwrap(); | 7 | let current_dir = env::var("PWD").unwrap(); |
8 | 8 | ||
9 | let mut repo: Option<Repository> = None; | 9 | let mut repo: Option<Repository> = None; |
10 | let current_path = Path::new(¤t_dir[..]); | 10 | let current_path = Path::new(¤t_dir[..]); |
11 | for path in current_path.ancestors() { | 11 | for path in current_path.ancestors() { |