aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2019-05-20 14:40:40 +0100
committerNerdyPepper <[email protected]>2019-05-20 14:40:40 +0100
commitd61e0ff1e192c62085e842ba878cdb10bacd4c9e (patch)
tree8624f9e8f2ce0bf3cdc1de0a1b7214a6d442b03b /src/main.rs
parent7bc593296e9a5ed693a30c92c25653d4a6cfcb54 (diff)
add pista and pista_minimal prompts
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index bfa47a0..e0b8f41 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,11 +3,34 @@ mod prompt_char;
3mod vcs; 3mod vcs;
4mod venv; 4mod venv;
5 5
6use colored::*;
7
8fn main() { 6fn main() {
9 print!("{}", cwd::cwd()); 7 println!("{}", pista());
8}
9
10fn pista() -> String {
11 let cwd = cwd::cwd();
12 let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into()));
13 let venv = venv::get_name();
14 let prompt_char = prompt_char::get_char();
15 format!("{cwd} {branch} {status}\n{venv}{pchar} ",
16 cwd=cwd,
17 branch=branch,
18 status=status,
19 venv=venv,
20 pchar=prompt_char
21 )
22}
23
24fn pista_minimal() -> String {
25 let cwd = cwd::cwd();
10 let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); 26 let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into()));
11 println!(" {} {}", branch, status.dimmed()); 27 let venv = venv::get_name();
12 print!("{}{} ", venv::get_name(), prompt_char::prompt_char()); 28 let prompt_char = prompt_char::get_char();
29 format!("{cwd} {branch}{status}{venv}{pchar}",
30 cwd=cwd,
31 branch=branch,
32 status=status,
33 venv=venv,
34 pchar=prompt_char
35 )
13} 36}