From 19713431a6911df41d18a52bdb2c1ac9ba46bfed Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Sun, 15 Sep 2024 17:34:57 -0700 Subject: [PATCH] Update git-repl: allow the repl to be started with a command --- bin/git-repl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/git-repl b/bin/git-repl index 78899a55..74e1210c 100755 --- a/bin/git-repl +++ b/bin/git-repl @@ -15,11 +15,16 @@ while true; do prompt="$exit_status|git> " fi - # Readline - read -e -r -p "$prompt" cmd - - # EOF - test $? -ne 0 && break + # Use arguments as a command if any are provided + if [ $# -eq 0 ]; then + cmd="$@" + set -- + else + # Readline + read -e -r -p "$prompt" cmd + # check for EOF, and end the program if so (handles ^D) + test $? -ne 0 && break + fi # History history -s "$cmd"