|
| 1 | +import subprocess |
| 2 | + |
| 3 | + |
| 4 | +def display_intro_text() -> None: |
| 5 | + """ |
| 6 | + Displays the Introduction Text of the Library as a Nice and Friendly UI |
| 7 | + Alongside a short instructions on how to use the library for new users. |
| 8 | + """ |
| 9 | + intro_message = """ |
| 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 | + print(intro_message) |
| 35 | + description = """ |
| 36 | + Generate a fully structured FastAPI projects instantly. |
| 37 | + Boilerplate code, ready-to-run endpoints, and project scaffolding |
| 38 | + all in one simple command. Kickstart your backend in seconds! |
| 39 | + |
| 40 | + Provide Project Details to each prompt and press 'Enter' to complete project setup |
| 41 | + |
| 42 | + NOTES: Values placed within square brackets ([My Awesome FastAPI Project]) are defaults values for the project details |
| 43 | + If you do not provide a value for any particular, those values are used instead. |
| 44 | + |
| 45 | + Have a Blast 🚀 - Brian |
| 46 | + _____________________________________________________________________________________________________ |
| 47 | + """ |
| 48 | + # FUN 🚀 |
| 49 | + |
| 50 | + # How Fast Can you Complete your FastAPI project setup? |
| 51 | + # Blaze through the steps to make the global leaderboard for projects generated with FastAPI Project Gen8. |
| 52 | + # In Order to qualify for this leaderboard, you have to make sure to input every project detail and not use defaults |
| 53 | + # even though the defaults match your project attribute. |
| 54 | + # Current Best Record: {get_current_best_record()[0]} seconds - Title: [{get_current_best_record()[1]}] |
| 55 | + print(description) |
| 56 | + |
| 57 | + |
| 58 | +def slugify(text: str) -> str: |
| 59 | + return text.replace(" ", "_").replace("-", "_").lower() |
| 60 | + |
| 61 | +def success_print(value: str): |
| 62 | + print("\033[92m{}\033[00m".format(value)) |
| 63 | + |
| 64 | +def warning_print(value: str): |
| 65 | + print("\033[33m{}\033[00m".format(value)) |
| 66 | + |
| 67 | +def error_print(value: str): |
| 68 | + print("\033[31m{}\033[00m".format(value)) |
| 69 | + |
| 70 | + |
| 71 | +def clone_repository(repository_url: str, folder_name: str): |
| 72 | + try: |
| 73 | + clone_template_repo = subprocess.Popen(["git", "clone", repository_url, folder_name]) |
| 74 | + clone_template_repo.wait() |
| 75 | + except Exception as err: |
| 76 | + error_print(f"Failed to Download Template: Reason: {err}") |
| 77 | + exit(1) |
| 78 | + |
| 79 | + |
0 commit comments