tunuifranken.info/bin/pull-cv.sh

53 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# This script is executed by make in the parent directory
[ "$HOSTNAME" != lime2 ] || exit 1
main() {
verbose -n "Pulling CV... "
mkdir -p ./cv/{css,data,en,fr}
cp ~/src/html-cv/out.en.html ./cv/en/index.html
cp ~/src/html-cv/out.fr.html ./cv/fr/index.html
hide_phone ./cv/en/index.html
hide_phone ./cv/fr/index.html
hide_address ./cv/en/index.html
hide_address ./cv/fr/index.html
hide_city ./cv/en/index.html
hide_city ./cv/fr/index.html
cp ~/src/html-cv/data/cv-photo ./cv/data/cv-photo
cp ~/src/html-cv/data/internet-icon.png ./cv/data/internet-icon.png
cp ~/src/html-cv/data/git-icon.png ./cv/data/git-icon.png
cp -r ~/src/html-cv/css ./cv
if git status | grep cv | grep -v 'pull-cv.sh' -c >/dev/null 2>&1; then
echo "Updated CV"
fi
verbose "Done"
}
hide_phone() {
html_file="$1"
sed -i -E 's/\+33 6( [0-9]{2}){4}/[téléphone caché]/' "$html_file"
}
hide_address() {
html_file="$1"
sed -i -E 's/[0-9]{2,3} (rue|avenue|av\.?|boulevard|bld|place|pl\.?) [a-zA-Z ]+/[adresse cachée]/' "$html_file"
}
hide_city() {
html_file="$1"
sed -i -E 's/[0-9]{5} [a-zA-Z]+/[code postal et ville cachés]/' "$html_file"
}
verbose() {
if [ "$VERBOSE" = true ]; then
echo "$@"
fi
}
main