From d61e0ff1e192c62085e842ba878cdb10bacd4c9e Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Mon, 20 May 2019 19:10:40 +0530 Subject: add pista and pista_minimal prompts --- src/main.rs | 33 ++++++++++++++++++++++++++++----- 1 file 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; mod vcs; mod venv; -use colored::*; - fn main() { - print!("{}", cwd::cwd()); + println!("{}", pista()); +} + +fn pista() -> String { + let cwd = cwd::cwd(); + let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); + let venv = venv::get_name(); + let prompt_char = prompt_char::get_char(); + format!("{cwd} {branch} {status}\n{venv}{pchar} ", + cwd=cwd, + branch=branch, + status=status, + venv=venv, + pchar=prompt_char + ) +} + +fn pista_minimal() -> String { + let cwd = cwd::cwd(); let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); - println!(" {} {}", branch, status.dimmed()); - print!("{}{} ", venv::get_name(), prompt_char::prompt_char()); + let venv = venv::get_name(); + let prompt_char = prompt_char::get_char(); + format!("{cwd} {branch}{status}{venv}{pchar}", + cwd=cwd, + branch=branch, + status=status, + venv=venv, + pchar=prompt_char + ) } -- cgit v1.2.3