tunuifranken.info/bin/pull-cv.sh

67 lines
1.7 KiB
Bash
Raw Normal View History

2021-01-12 14:20:08 +01:00
#!/bin/bash
2021-03-05 16:18:59 +01:00
# This script is executed by make in the parent directory
2021-09-05 18:26:40 +02:00
main() {
verbose -n "Pulling CV... "
2023-02-03 23:57:29 +01:00
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
2023-02-04 00:04:15 +01:00
hide_phone ./cv/en/index.html en
hide_phone ./cv/fr/index.html fr
hide_address ./cv/en/index.html en
hide_address ./cv/fr/index.html fr
hide_city ./cv/en/index.html en
hide_city ./cv/fr/index.html fr
2021-09-05 18:26:40 +02:00
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() {
2022-01-09 22:38:57 +01:00
html_file="$1"
2023-02-04 00:04:15 +01:00
lang="$2"
if [ "$lang" = 'en' ]; then
sed -i -E 's/\+33 6( [0-9]{2}){4}/[phone hidden]/' "$html_file"
elif [ "$lang" = 'fr' ]; then
sed -i -E 's/\+33 6( [0-9]{2}){4}/[téléphone caché]/' "$html_file"
fi
2021-09-05 18:26:40 +02:00
}
hide_address() {
2022-01-09 22:38:57 +01:00
html_file="$1"
2023-02-04 00:04:15 +01:00
lang="$2"
if [ "$lang" = 'en' ]; then
sed -i -E 's/[0-9]{2,3} (rue|avenue|av\.?|boulevard|bld|place|pl\.?) [a-zA-Z ]+/[address hidden]/' "$html_file"
elif [ "$lang" = 'fr' ]; then
sed -i -E 's/[0-9]{2,3} (rue|avenue|av\.?|boulevard|bld|place|pl\.?) [a-zA-Z ]+/[adresse cachée]/' "$html_file"
fi
2021-09-05 18:26:40 +02:00
}
hide_city() {
2022-01-09 22:38:57 +01:00
html_file="$1"
2023-02-04 00:04:15 +01:00
lang="$2"
if [ "$lang" = 'en' ]; then
sed -i -E 's/[0-9]{5} [a-zA-Z]+/[zip and city hidden]/' "$html_file"
elif [ "$lang" = 'fr' ]; then
sed -i -E 's/[0-9]{5} [a-zA-Z]+/[code postal et ville cachés]/' "$html_file"
fi
2021-09-05 18:26:40 +02:00
}
verbose() {
if [ "$VERBOSE" = true ]; then
echo "$@"
fi
}
main