mirror of
https://github.com/tj/git-extras.git
synced 2026-09-13 00:46:26 -04:00
Merge pull request #89 from nulltask/feature/repl-display-branch
Added displaying current branch name to git-repl(1) prompt
This commit is contained in:
commit
32f836bfd1
13
bin/git-repl
13
bin/git-repl
|
|
@ -1,8 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
# Current branch
|
||||
cur=`git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-`
|
||||
|
||||
# Prompt
|
||||
if [ $cur ]
|
||||
then
|
||||
prompt="git ($cur)> "
|
||||
else
|
||||
prompt="git> "
|
||||
fi
|
||||
|
||||
# Readline
|
||||
read -e -r -p "git> " cmd
|
||||
read -e -r -p "$prompt" cmd
|
||||
|
||||
# EOF
|
||||
test $? -ne 0 && break
|
||||
|
|
|
|||
Loading…
Reference in a new issue