-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_resume.py
63 lines (48 loc) · 1.57 KB
/
get_resume.py
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
import argparse
import json
import textwrap
BOLD = "\033[1m"
RESET = "\033[0m"
def print_profile(json_data):
print(f"\n{BOLD}{json_data['name']} ― {json_data['title']} 🚀{RESET}\n")
description = textwrap.fill(
json_data["description"],
width=100,
subsequent_indent=" ",
)
print(f" {description}\n")
print(f"{BOLD}Abilities and Tech Stack 💻{RESET}\n")
for ability, items in json_data["abilities"].items():
print(f" • {BOLD}{ability}{RESET}: {', '.join(items)}")
print(f"\n{BOLD}Education 🎓{RESET}\n")
for education in json_data["educations"]:
school, degree, duration = (
education["school"],
education["degree"],
education["duration"],
)
print(f" • {BOLD}{degree}{RESET}: {school}, {duration}")
print(f"\n{BOLD}Contact ☎️{RESET}\n")
for contact_type, contact_value in json_data["contacts"].items():
print(f" • {BOLD}{contact_type}{RESET}: {contact_value}")
def main():
parser = argparse.ArgumentParser(
description="Print profile information dynamically from JSON file"
)
parser.add_argument(
"--username",
"-u",
help="The username of the profile",
type=str,
)
args = parser.parse_args()
with open("profiles.json") as f:
data = json.load(f)
username = args.username
if username not in data:
print(f"Profile for {username} not found.")
return
print_profile(data[username])
print()
if __name__ == "__main__":
main()