summaryrefslogblamecommitdiff
path: root/resume.py
blob: 3da5a51d4ae202bfd623bf82fb4a2266b5b3f77a (plain) (tree)


















































































                                                                                                                          
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()