From 4cba06896d9a9be0431cfcd7275667e5a25956d7 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 27 Jun 2016 18:19:40 +0200 Subject: Konfig und skipDirRegEx neu --- .gitignore | 1 + Makefile | 8 +++++--- bash-git-prompt.conf.in | 3 +++ bash-git-prompt.in | 10 +++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 bash-git-prompt.conf.in diff --git a/.gitignore b/.gitignore index d611c9e..180b9bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ bash-git-prompt +bash-git-prompt.conf diff --git a/Makefile b/Makefile index 66e50df..210ad34 100644 --- a/Makefile +++ b/Makefile @@ -21,21 +21,23 @@ DESTDIR = BINDIR = /usr/bin +ETCDIR = /etc VERSION = 0.12 -all: bash-git-prompt +all: bash-git-prompt bash-git-prompt.conf %: %.in - sed "s/#VERSION#/$(VERSION)/" $< > $@ + sed "s/#VERSION#/$(VERSION)/; s@#ETCDIR#@$(ETCDIR)@" $< > $@ .PHONY: install clean install: all install -D -m0755 -t $(DESTDIR)$(BINDIR) bash-git-prompt + install -D -m0644 -t $(DESTDIR)$(ETCDIR) bash-git-prompt.conf clean: - rm -f bash-git-prompt + rm -f bash-git-prompt bash-git-prompt.conf dist: clean git status --porcelain 2> /dev/null | grep -q "\S" && (git add .; git commit -m"neue Version: $(VERSION)") || true diff --git a/bash-git-prompt.conf.in b/bash-git-prompt.conf.in new file mode 100644 index 0000000..ebe1ab9 --- /dev/null +++ b/bash-git-prompt.conf.in @@ -0,0 +1,3 @@ +#/bin/bash + +skipDirRegEx='^$' diff --git a/bash-git-prompt.in b/bash-git-prompt.in index 2f40afe..b678bfb 100755 --- a/bash-git-prompt.in +++ b/bash-git-prompt.in @@ -16,7 +16,15 @@ PS1="$PS1Start" -if status=$(git status --porcelain 2> /dev/null) +. #ETCDIR#/bash-git-prompt.conf + +skip=false +if [ -n "${skipDirRegEx}" ] && pwd | grep -q "${skipDirRegEx}" &> /dev/null +then + skip=true +fi + +if ! ${skip} && status=$(git status --porcelain 2> /dev/null) then PS1="$PS1 " branch="$((git symbolic-ref HEAD 2> /dev/null || git describe --always) | sed "s|^.*/||")" -- cgit v1.2.3-54-g00ecf