aboutsummaryrefslogtreecommitdiff
path: root/src/prompt_char.rs
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2019-05-20 14:40:10 +0100
committerNerdyPepper <[email protected]>2019-05-20 14:40:10 +0100
commit7bc593296e9a5ed693a30c92c25653d4a6cfcb54 (patch)
treefd8df34977815d0fb214d3eba6ae2c71267ba6fb /src/prompt_char.rs
parent9a5623a79523f5727c096870d98e2f8112d395ed (diff)
add config opts for prompt chars
Diffstat (limited to 'src/prompt_char.rs')
-rw-r--r--src/prompt_char.rs12
1 files changed, 7 insertions, 5 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 @@
1use std::env; 1use std::env;
2use colored::*; 2use colored::*;
3 3
4pub fn prompt_char() -> colored::ColoredString { 4pub 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