summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-06-27 18:19:40 +0200
committerErich Eckner <git@eckner.net>2016-06-27 18:42:45 +0200
commit4cba06896d9a9be0431cfcd7275667e5a25956d7 (patch)
tree749025218b896a00108617644d46c4e25186ad62
parenta626f841c71f3bc9c2a645d04ccc0f33685391cc (diff)
downloadbash-git-prompt-4cba06896d9a9be0431cfcd7275667e5a25956d7.tar.xz
Konfig und skipDirRegEx neu
-rw-r--r--.gitignore1
-rw-r--r--Makefile8
-rw-r--r--bash-git-prompt.conf.in3
-rwxr-xr-xbash-git-prompt.in10
4 files changed, 18 insertions, 4 deletions
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|^.*/||")"