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 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6934580..a016cdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,7 +259,7 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "pista" -version = "0.1.4" +version = "0.1.5" dependencies = [ "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index 8255973..bb0794b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pista" -version = "0.1.4" +version = "0.1.5" authors = ["NerdyPepper "] edition = "2018" description = "A simple bash prompt for programmers" 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