From 77583eca73bb7f386d6466414e150794578326df Mon Sep 17 00:00:00 2001 From: Joshua Yun Date: Wed, 6 Apr 2022 17:43:50 -0500 Subject: initial commit --- resume.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 resume.py (limited to 'resume.py') diff --git a/resume.py b/resume.py new file mode 100644 index 0000000..3da5a51 --- /dev/null +++ b/resume.py @@ -0,0 +1,83 @@ +import json +import shutil +shutil.copyfile('template.tex', 'Yun_Joshua_Resume.tex') +f = open('resume.json') + +experiences = json.load(f) +list_of_experiences = [] +keys = list(experiences.keys()) +f.close() + + +def max (input): + max = 0 + for i in input: + if i > max: + max = i + + return max + +def choose(list_of_choices): + while True: + try: + choices = list(map(int,list(input("Select your choices: ").split()))) + if len(choices) > len(list_of_choices): + print("Invalid Input, Try again") + continue + if max(choices) >= len(list_of_choices): + print("Invalid Input, Try again") + continue + except ValueError: + print("Invalid Input, Try again") + continue + return choices + + +for count, key in enumerate(keys): + list_of_experiences.append(key) + print(f"Choice {count}: {experiences[key]['title']}" ) + +choices = choose(list_of_experiences) + +selected_experiences = [] +print("\nYou have selected:") +for choice in choices: + selected_experiences.append(keys[choice]) + print(experiences[list_of_experiences[choice]]['title']) + +print("\n") + +resume = open("Yun_Joshua_Resume.tex", "a") +resume.write('\n') +for experience in selected_experiences: + # TODO: Write title and date to latex + + resume.write(f"{{\\large\\textbf{{{experiences[experience]['title']}}}}} \\hfill {experiences[experience]['date']}\n") + print(f"Select your bullet points for: {experiences[experience]['title']}") + list_of_bullet_points = [] + bullet_points = experiences[experience] + bullet_keys = list(bullet_points.keys()) + count = 0 + for bullet in bullet_keys: + if bullet == 'title' or bullet == 'date': + continue + else: + list_of_bullet_points.append(bullet_points[bullet]) + print(f"Number {count}: {bullet_points[bullet]}") + count = count + 1 + + bullet_choice = choose(list_of_bullet_points) + + selected_bullets = [] + print("\nYou have selected:") + resume.write("\\begin{itemize}[noitemsep]\n") + for choice in bullet_choice: + selected_bullets.append(bullet_keys[choice]) + resume.write(f"\\item {list_of_bullet_points[choice]}\n") + print(list_of_bullet_points[choice]) + # TODO: Write this bullet point to latex + print("\n") + resume.write("\\end{itemize}\n") + +resume.write("\\end{document}\n") +resume.close() -- cgit v1.2.3