|
2 | 2 | import os |
3 | 3 | import sys |
4 | 4 |
|
| 5 | +import inquirer |
5 | 6 | import yaml |
6 | 7 |
|
7 | 8 | if __name__ == "__main__": |
|
20 | 21 | # The FullLoader parameter handles the conversion from YAML |
21 | 22 | # scalar values to Python the dictionary format |
22 | 23 | pyflask_pref_dict = yaml.load(file, Loader=yaml.FullLoader) |
23 | | - print(pyflask_pref_dict) |
| 24 | + |
| 25 | + new_service_name = input(f"Enter service name: (current_name = {pyflask_pref_dict['service_name']}) :: ") |
| 26 | + pyflask_pref_dict["service_name"] = new_service_name if new_service_name != "" else pyflask_pref_dict["service_name"] |
| 27 | + |
| 28 | + new_python_env_name = input(f"Enter python environment name: (current_name {pyflask_pref_dict['python_env_name']}) :: ") |
| 29 | + pyflask_pref_dict["python_env_name"] = ( |
| 30 | + new_python_env_name if new_python_env_name != "" else pyflask_pref_dict["python_env_name"] |
| 31 | + ) |
| 32 | + |
| 33 | + questions = [inquirer.List("python_version", message="Use python version :: ", choices=["3.7", "3.8"])] |
| 34 | + answers = inquirer.prompt(questions) |
| 35 | + if answers["python_version"] == "3.8": |
| 36 | + pyflask_pref_dict["python_base_version_minor"] = 8 |
| 37 | + elif answers["python_version"] == "3.7": |
| 38 | + pyflask_pref_dict["python_base_version_minor"] = 7 |
| 39 | + |
| 40 | + questions = [inquirer.List("python_env_manager", message="Use python env manager :: ", choices=["conda", "venv"])] |
| 41 | + answers = inquirer.prompt(questions) |
| 42 | + pyflask_pref_dict["python_env_manager"] = answers["python_env_manager"] |
| 43 | + |
| 44 | + new_docker_maintainer_username = input("Enter docker maintainer username :: ") |
| 45 | + new_docker_maintainer_email = input("Enter docker maintainer email :: ") |
| 46 | + pyflask_pref_dict["docker_maintainer_details"] = f"{new_docker_maintainer_username} <{new_docker_maintainer_email}>" |
| 47 | + |
| 48 | + pyflask_pref_dict["is_personalized"] = True |
| 49 | + |
24 | 50 | with open(r"./pyflask-preferences.yaml", "w") as file: |
25 | 51 | documents = yaml.dump(pyflask_pref_dict, file) |
26 | 52 |
|
|
0 commit comments