diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | bash-git-prompt.conf.in | 3 | ||||
-rwxr-xr-x | bash-git-prompt.in | 10 |
4 files changed, 18 insertions, 4 deletions
@@ -1 +1,2 @@ bash-git-prompt +bash-git-prompt.conf @@ -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|^.*/||")" |