From 5b022fa71a26176dabc92afb211ab8f3707c2020 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 2 Apr 2021 18:15:56 +0530 Subject: add flag to disable vcs --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 1a77759..6ccca7b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ mod prompt_char; mod vcs; mod venv; +use std::env; + use clap::{App, Arg}; use colored::*; @@ -36,7 +38,10 @@ fn pista(zsh: bool) -> String { Some(c) => c, None => "[directory does not exist]".color("red"), }; - let (branch, status) = vcs::vcs_status().unwrap_or(("".into(), "".into())); + let (branch, status) = match env::var("DISABLE_VCS").unwrap_or("0".into()).as_ref() { + "0" => vcs::vcs_status().unwrap_or(("".into(), "".into())), + _ => ("".into(), "".into()) + }; let venv = venv::get_name(); let prompt_char = prompt_char::get_char(); if zsh { -- cgit v1.2.3