aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..6ddfe0f
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,31 @@
1use std::env;
2use tico::tico;
3
4fn main() {
5 println!("{}", cwd());
6 println!("{}", prompt_char());
7}
8
9fn cwd() -> String {
10 let path = env::var("PWD").unwrap();
11 let short_or_not = env::var("SHORTEN_CWD").unwrap_or("1".into());
12
13 match short_or_not.as_ref() {
14 "0" => path,
15 _ => tico(&path[..])
16 }
17}
18
19fn prompt_char() -> String {
20 let user_char = env::var("PROMPT_CHAR").unwrap_or("$ ".into());
21 let root_char = env::var("PROMPT_CHAR_ROOT").unwrap_or("# ".into());
22
23 let euid = unsafe { libc::geteuid() };
24 match euid {
25 0 => return root_char,
26 _ => return user_char
27 }
28}
29
30fn vcs() -> String {
31}