tj.git-extras/bin/git-repl
Dave James Miller 8fcabe34a3 Improvements to git-repl
Fix history support by padding -e to read again, and forcing use of Bash instead of default shell (dash on Debian doesn't work).

Fix support of quotes in commands by using eval.

Don't show git help when pressing enter without typing a command.
2012-03-26 15:19:36 -07:00

25 lines
283 B
Bash
Executable file

#!/bin/bash
while true; do
# Readline
read -e -r -p "git> " cmd
# EOF
test $? -ne 0 && break
# History
history -s "$cmd"
# Built-in commands
case $cmd in
ls) cmd=ls-files;;
"") continue;;
quit) break;;
esac
# Execute
eval git "$cmd"
done
echo