insufficient

trash python program #1

Oct 2nd, 2021
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.75 KB | None | 0 0
  1.  
  2. # INSUFFICENT PROJECT CREATOR #
  3. # 2021 #
  4. # VERSION 1.0 (DEV VERSION) #
  5. # MAIN VARIABLES/OTHER
  6. supportedprojtypes = ["html"]
  7. class textcolors:
  8.     HEADER = '\033[95m'
  9.     OKBLUE = '\033[94m'
  10.     OKCYAN = '\033[96m'
  11.     OKGREEN = '\033[92m'
  12.     WARNING = '\033[93m'
  13.     FAIL = '\033[91m'
  14.     ENDC = '\033[0m'
  15.     BOLD = '\033[1m'
  16.     UNDERLINE = '\033[4m'
  17.  
  18. # IMPORTS
  19. import os
  20. # ACTUAL PROGRAM
  21. print("---- Project Creator By Insufficent ----")
  22. print("Enter project type: ")
  23. projtype = input(">>> ")
  24. if projtype not in supportedprojtypes:
  25.     print(f"{textcolors.FAIL}Error: No such type exists!{textcolors.ENDC}")
  26.    
  27. print("Enter project name: ")
  28. projname = input(">>> ")
  29. # TEMPLATES
  30. htmlprojhtml = """<!DOCTYPE html>
  31. <html lang="en">
  32. <head>
  33.    <meta charset="UTF-8">
  34.    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  35.    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  36.    <link href="style.css" rel="stylesheet"/>
  37.    <title>Document</title>
  38. </head>
  39. <body>
  40.    <!-- Content Here -->
  41. <script src="script.js"></script>
  42. </body>
  43. </html>
  44. """
  45. htmlprojcss = """body {
  46.    margin: 0;
  47.    padding: 0;
  48. }
  49. """
  50. projectpath = os.path.join(os.getcwd(), projname)
  51.  
  52. if projtype == "html":
  53.     os.mkdir(projectpath)
  54.     newHTMLfle = open(f"{projectpath}/index.html", "w").write(htmlprojhtml)
  55.     newCSSfile = open(f"{projectpath}/style.css", "w").write(htmlprojcss)
  56.     newJSfile = open(f"{projectpath}/script.js", "w") # Requires no write() since its content will be empty.
  57.     print(f"{textcolors.OKGREEN}{textcolors.BOLD}Project Successfully Created!{textcolors.ENDC}")
  58.     print(f"At path {os.getcwd()}")
  59. else:
  60.     print(f"{textcolors.FAIL}Error: Project Not Created, No Such type exists!{textcolors.ENDC}")
Advertisement
Add Comment
Please, Sign In to add comment