aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/main.rs b/src/main.rs
index 48ddbf8..3e2b096 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,7 +4,7 @@ use git2::{ Repository, Status };
4use colored::*; 4use colored::*;
5 5
6fn main() { 6fn main() {
7 print!("{}", cwd()); 7 // print!("{}", cwd());
8 let (branch, status) = match vcs_status() { 8 let (branch, status) = match vcs_status() {
9 Some((x, y)) => { 9 Some((x, y)) => {
10 (x, y) 10 (x, y)
@@ -15,15 +15,12 @@ fn main() {
15 print!("{} ", prompt_char()); 15 print!("{} ", prompt_char());
16} 16}
17 17
18fn cwd() -> String { 18// fn cwd() -> String {
19 let path = env::var("PWD").unwrap(); 19// let path = env::var("PWD").unwrap();
20 let short_or_not = env::var("SHORTEN_CWD").unwrap_or("1".into()); 20// let short_or_not = env::var("SHORTEN_CWD").unwrap_or("1".into());
21 21//
22 match short_or_not.as_ref() { 22// _ => tico(&path[..])
23 "0" => path, 23// }
24 _ => tico(&path[..])
25 }
26}
27 24
28fn prompt_char() -> colored::ColoredString { 25fn prompt_char() -> colored::ColoredString {
29 let user_char = env::var("PROMPT_CHAR").unwrap_or("$ ".into()); 26 let user_char = env::var("PROMPT_CHAR").unwrap_or("$ ".into());
@@ -61,23 +58,23 @@ fn vcs_status() -> Option<(colored::ColoredString, String)> {
61 for file in file_stats.iter() { 58 for file in file_stats.iter() {
62 match file.status() { 59 match file.status() {
63 Status::WT_NEW | 60 Status::WT_NEW |
64 Status::WT_MODIFIED | 61 Status::WT_MODIFIED |
65 Status::WT_DELETED | 62 Status::WT_DELETED |
66 Status::WT_TYPECHANGE | 63 Status::WT_TYPECHANGE |
67 Status::WT_RENAMED => { 64 Status::WT_RENAMED |
68 let stat_char = env::var("GIT_DIRTY").unwrap_or("×".into()); 65 Status::INDEX_NEW |
69 repo_stat = stat_char; 66 Status::INDEX_MODIFIED |
70 break; 67 Status::INDEX_DELETED |
71 }, 68 Status::INDEX_TYPECHANGE |
72 Status::INDEX_NEW | 69 Status::INDEX_RENAMED => {
73 Status::INDEX_MODIFIED | 70 let stat_char = env::var("GIT_DIRTY").unwrap_or("×".into());
74 Status::INDEX_DELETED | 71 repo_stat = stat_char;
75 Status::INDEX_TYPECHANGE | 72 break;
76 Status::INDEX_RENAMED => { 73 },
74 _ => {
77 let stat_char = env::var("GIT_CLEAN").unwrap_or("·".into()); 75 let stat_char = env::var("GIT_CLEAN").unwrap_or("·".into());
78 repo_stat = stat_char; 76 repo_stat = stat_char;
79 } 77 }
80 _ => { }
81 } 78 }
82 } 79 }
83 return Some((branch, repo_stat)) 80 return Some((branch, repo_stat))