Keep output of git "live" (Meaning that one can see live what submodule is currently pulled) by not saving it first and then grepping but by catching a failing grep when the output of git was empty.
18 lines
353 B
Bash
18 lines
353 B
Bash
#!/bin/bash
|
|
|
|
[ $# -eq 1 ] || { echo "Specify what to do" >&2; exit 1; }
|
|
|
|
case "$1" in
|
|
"--init") INIT=1;;
|
|
"--update") INIT=0;;
|
|
*) echo "Unknown option"; exit 1;;
|
|
esac
|
|
|
|
if (( $INIT )); then
|
|
git submodule update --init --recursive --jobs 8 --depth 1 2>&1 \
|
|
| grep "Cloning into" \
|
|
|| ! (( ${PIPESTATUS[0]} ))
|
|
else
|
|
git submodule update --remote
|
|
fi
|