Improve pull output, inspired by `zimfw update`

This commit is contained in:
Adam Goldsmith 2023-04-15 21:47:21 -04:00
parent 97b399681e
commit 51362d8c81
1 changed files with 8 additions and 3 deletions

11
dup
View File

@ -48,10 +48,15 @@ function do_pull_maybe_quiet() {
name="$1"
dir="${2:-$name}"
git_out="$(do_pull $dir)"
if [[ "$quiet" != true || "$git_out" != "Already up to date." ]]
first_line="${git_out%%$'\n'*}"
if [[ "$quiet" != true || "$first_line" != "Already up to date." ]]
then
echo "Updating $name"
echo "$git_out"
echo "$(tput setaf 4)}$(tput sgr0) $(tput bold)$name$(tput sgr0): $first_line"
fi
if [[ $first_line == Updating* ]]
then
git -C "${dir}" log --graph --color --format='%C(yellow)%h%C(reset) %s %C(cyan)(%cr)%C(reset)' ${first_line##Updating } \
| sed 's/^/ /'
fi
}