-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·118 lines (104 loc) · 2.81 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
set -eu
# define constants
PYTHON="python3"
README_FILE="README.md"
RESUME_FILE="Tom_Cooper_resume.md"
display_help() {
echo
echo "usage: ${0} [options]"
echo "options:"
echo " -e Print versions for environment tools."
echo " -g Generate resume."
echo " -h Print this usage for help."
echo " -v Enable verbose output."
}
display_environment_versions() {
echo
echo "* Git:"
git --version
echo
echo "* Python:"
${PYTHON} --version
echo
echo "* Visual Studio Code:"
code --version
echo
}
generate_resume() {
# clean resume file
rm -f ${RESUME_FILE}
# append title and about section to resume file
output_to_file "# Tom Cooper"
output_to_file
output_to_file "## About Me"
output_to_file
output_to_file "Location: Baltimore, MD, USA <br>"
output_to_file "Email: [email protected] <br>"
output_to_file "Website: https://github.com/tacooper <br>"
output_to_file "Education: Virginia Tech, Electrical Engineering (B.S. 2010, M.S. 2012) <br>"
# generate and append projects section to resume file
output_to_file
output_to_file "## Software Projects"
output_to_file
PROJECTS=$(${PYTHON} generate_projects.py)
output_to_file "${PROJECTS}"
# generate and append skills section to resume file
output_to_file
output_to_file "## Skill Ratings"
output_to_file
output_to_file "Name | Proficiency"
output_to_file "--- | ---"
SKILLS=$(${PYTHON} generate_skills.py)
output_to_file "${SKILLS}"
# generate and append tools section to resume file
output_to_file
output_to_file "## Miscellaneous Tools"
output_to_file
TOOLS=$(${PYTHON} generate_tools.py)
output_to_file "${TOOLS}"
# generate and append date to resume file
DATE=$(date "+%m/%d/%Y")
output_to_file
output_to_file "---"
output_to_file
output_to_file "Generated by https://github.com/tacooper/resume-goldberg-machine on ${DATE}."
# replace existing date in Readme file
sed -i -r "s|[0-9]{2}/[0-9]{2}/[0-9]{4}|${DATE}|g" ${README_FILE}
}
output_to_file() {
# append new line and optional argument to resume file
if [[ $# -eq 0 ]]; then
echo >> ${RESUME_FILE}
else
echo "$1" >> ${RESUME_FILE}
fi
}
# handle each option specified on command line
while getopts ":eghv" FLAG; do
case ${FLAG} in
v)
# enable verbose output
set -x
;;
e)
display_environment_versions
;;
g)
generate_resume
;;
h)
display_help
;;
*)
display_help
exit 1
;;
esac
done
# ensure at least one option exists
if [[ $# -eq 0 ]]; then
echo "Specify at least one option!"
exit 1
fi
exit 0