blob: 1df4c5d8ed9ded68a662ad222f8b097b6fb268ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use std::env;
use colored::*;
pub fn prompt_char() -> colored::ColoredString {
let user_char = env::var("PROMPT_CHAR").unwrap_or("$ ".into());
let root_char = env::var("PROMPT_CHAR_ROOT").unwrap_or("# ".into());
let euid = unsafe { libc::geteuid() };
match euid {
0 => return root_char.red(),
_ => return user_char.green()
}
}
|