GitDeepDive/utils.sh

46 lines
879 B
Bash

# A function to make a statement.
declaim () {
echo
echo ${*}
echo "==============="
echo
}
# A function to sleep for a bit if the environmental variable SLEEPS
# is Y
sleepies () {
if [ "${SLEEPS}" = "Y" ]; then
sleep ${1}
fi
}
# A function to print the git command to be executed and then to
# execute it
git_command() {
# Print out the command.
echo
echo "git command: ${*}"
# Some variable initialisations
COMMANDSTRING="${*}"
counter=0
UNDERLINESTRING=""
# Build UNDERLINESTRING to be a string of '-' characters the same
# length of all the options passed in.
while [ ${counter} -lt ${#COMMANDSTRING} ]
do
UNDERLINESTRING="${UNDERLINESTRING}-"
counter=$(( ${counter} + 1 ))
done
# Print the pretty underline
echo -n " "
echo ${UNDERLINESTRING}
echo
# Execute the command.
eval ${*}
}