-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresume.sh
executable file
·77 lines (58 loc) · 1.92 KB
/
resume.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
#!/bin/bash
json=$(cat resume.json)
parse_array() {
name=$(echo "$json" | jq -r "$1 | map($2 | tojson) | .[]")
echo $name
}
parse_prop () {
echo "$json" | jq -r "$1"
}
bold() { echo "$(tput bold)$1$(tput sgr0)"; }
dim() { echo "$(tput dim)$1$(tput sgr0)"; }
colored() { echo "$(tput setaf 32)$1$(tput sgr0)"; }
output() {
echo "$1" >> resume.txt
}
format_section() {
echo "\n$(dim "###| ") $(bold $(colored $1)) $(dim " |$(printf '%*s' "$((40 - ${#1}))" | tr ' ' '=')")\n"
}
format_item () {
echo " $(dim "-") $1"
}
format_date() {
echo "$(dim [$1])"
}
> resume.txt
cat <<EOF > resume.txt
$(tput setaf 32) __
/ / __ _________ ____
/ /__/ // / __/ _ \`(_-<
/____/\_,_/\\__/\_,_/___/
_____ __
/ ___/__ ____ / /________
/ /__/ _ \`(_-</ __/ __/ _ \\
\\___/\\_,_/___/\\__/_/ \\___/$(tput sgr0)
EOF
eval "links=($(parse_array '.basics.profiles' '.url'))"
eval "links_labels=($(parse_array '.basics.profiles' '.network'))"
eval "works=($(parse_array '.work' '.position'))"
eval "works_companies=($(parse_array '.work' '.name'))"
eval "works_dates=($(parse_array '.work' '.startDate'))"
eval "works_summaries=($(parse_array '.work' '.summary'))"
eval "skills=($(parse_array '.skills' '.keywords[]'))"
output "$(bold "$(parse_prop '.basics.name')") | $(dim "$(parse_prop '.basics.email')") | $(dim "$(parse_prop '.basics.url')")"
output "$(bold "$(parse_prop '.basics.label')")"
output "$(format_section "About")"
output "$(parse_prop '.basics.summary')"
output "$(format_section "Links")"
for i in "${!links[@]}"; do
output "$(format_item "${links_labels[$i]} [$(dim ${links[$i]})]")"
done
output "$(format_section "Work")"
for i in "${!works[@]}"; do
output "$(format_date ${works_dates[$i]}) | $(bold "${works[$i]}") $(bold "@") ${works_companies[$i]}"
output " $(dim "${works_summaries[$i]}")"
done
output "$(format_section "Skills")"
output "$(format_item "${skills[*]}")"
output "\n"