Skip to content

Commit

Permalink
Update git-repl: allow the repl to be started with a command
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattscarpenter authored Sep 16, 2024
1 parent d4c540c commit 1971343
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bin/git-repl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1971343

Please sign in to comment.