From 68d87f12de7c0b5fc1ccafb0457ed976fc8b3ade Mon Sep 17 00:00:00 2001 From: Sean Enck Date: Sun, 24 Nov 2024 17:04:13 -0500 Subject: [PATCH] allow turning off prompt --- internal/uncommitted/core.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/uncommitted/core.go b/internal/uncommitted/core.go index 9f9a053..08624ca 100644 --- a/internal/uncommitted/core.go +++ b/internal/uncommitted/core.go @@ -51,8 +51,12 @@ func Current(s Settings) error { if s.Writer == nil { return errors.New("writer is nil") } + const key = "GIT_UNCOMMITTED" switch s.Mode { case "pwd": + if cli.IsYes(os.Getenv(key + "_NO_PROMPT")) { + return nil + } wd, err := os.Getwd() if err != nil { return err @@ -67,7 +71,6 @@ func Current(s Settings) error { default: return fmt.Errorf("unknown mode: %s", s.Mode) } - const key = "GIT_UNCOMMITTED" in := strings.TrimSpace(os.Getenv(key)) if in == "" { return nil