diff --git a/Commands.md b/Commands.md index 1b04250..9e70219 100644 --- a/Commands.md +++ b/Commands.md @@ -392,13 +392,20 @@ Type `exit`, `quit`, or `q` to end the repl session. Any arguments to git repl will be taken as the first command to execute in the repl. +You can specify a default command to run when hitting enter: + +```bash +git config --global git-extras.repl.on-enter-command "git status -sb" +``` + You can configure which character is used at the end of the prompt: (default `>`): ```bash git config --global git-extras.repl.prompt-character "±" ``` -You can specify the prefix for the prompt (default `git`): +You can specify the prefix for the prompt, or remove it (default `git`): + ```bash git config --global git-extras.repl.prefix "" ``` diff --git a/bin/git-repl b/bin/git-repl index b95d9d2..ef7181c 100755 --- a/bin/git-repl +++ b/bin/git-repl @@ -52,7 +52,14 @@ while true; do # Built-in commands case $cmd in ls) cmd=ls-files;; - "") continue;; + "") + on_enter_cmd=$(git config --get --default '' git-extras.repl.on-enter-command) + if test -n "$on_enter_cmd"; then + cmd="$on_enter_cmd" + else + continue + fi + ;; quit|exit|q) break;; esac diff --git a/man/git-repl.1 b/man/git-repl.1 index 162b0de..9816d4c 100644 --- a/man/git-repl.1 +++ b/man/git-repl.1 @@ -32,6 +32,10 @@ exit|quit|q .P Ends the repl session\. .SH "CONFIGURATION" +You can specify a default command to run when hitting enter: +.P +\fBgit config \-\-global git\-extras\.repl\.on\-enter\-command "git status \-sb"\fR +.P You can configure which character is used at the end of the prompt (default \fB>\fR): .P \fBgit config \-\-global git\-extras\.repl\.prompt\-character "±"\fR diff --git a/man/git-repl.html b/man/git-repl.html index d67ba2c..d3280ea 100644 --- a/man/git-repl.html +++ b/man/git-repl.html @@ -115,6 +115,10 @@
You can specify a default command to run when hitting enter:
+ +git config --global git-extras.repl.on-enter-command "git status -sb"
You can configure which character is used at the end of the prompt
(default >):