boussole/.local/bin/tutorial-submit.sh

33 lines
664 B
Bash
Executable file

#!/bin/sh
bold=$(tput bold)
normal=$(tput sgr0)
push() {
clang-format-epita .
git add --all
git commit -m "push"
git tag -ma "exercises-tutorial-$exercise-$(git rev-parse --short HEAD)"
git push --follow-tags
}
# Main
if [ $# -ne 1 ]; then
current_folder=${PWD##*/}
echo "Submit as$bold $current_folder$normal ? [Y/n]"
read yesno
if [ "$yesno" == "y" ] || [ "$yesno" == "Y" ] || [ -z "$yesno" ]; then
exercise=$current_folder
echo "------------------------------------"
echo "Pushing with tag$bold exercises-tutorial-$exercise-$(git rev-parse --short HEAD)$normal"
push
else
exit 1;
fi
else
exercise=$1
push
fi