diff --git a/create_site.py b/create_site.py index ad46b80..c7089e9 100644 --- a/create_site.py +++ b/create_site.py @@ -2,7 +2,7 @@ import argparse import subprocess -import color_io +import util.color_io as color_io parser = argparse.ArgumentParser(prog='Site Generator', description='Apache/Nginx Site Generator', epilog='Currently Only For Nginx') diff --git a/create_systemd_service.py b/create_systemd_service.py index 250b269..3cebc2b 100644 --- a/create_systemd_service.py +++ b/create_systemd_service.py @@ -2,7 +2,7 @@ import argparse import subprocess -import color_io +import util.color_io as color_io import sys parser = argparse.ArgumentParser(prog='SystemD Service Generator', description='SystemD Service Unit File Generator', epilog='Meow') diff --git a/create_webasm_page.py b/create_webasm_page.py new file mode 100755 index 0000000..28e329b --- /dev/null +++ b/create_webasm_page.py @@ -0,0 +1,210 @@ +#!/bin/python3 + +import argparse +import subprocess +import util.color_io as color_io +import sys + +parser = argparse.ArgumentParser(prog='WebASM Generator', description='Creates a webpage to run a WebASM Project, designed for use with emscripten', epilog='Meow') + +parser.add_argument("-i", "--install", nargs='?', const="/var/www/html/", default=None) +if ("--install" in sys.argv or "-i" in sys.argv): + parser.add_argument("file", default=None) + +args = parser.parse_args() + +f = sys.stdout + +html_base = """ + + + + + + ${TITLE HERE} + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + +""" + +if args.install: + path = args.install + if not args.install.endswith("/"): + path += "/" + path += args.file + if not args.file.endswith(".html"): + path += ".html" + f = open(path, "wt") + +def bprint(*args, **kwargs): + print(*args, file=f, **kwargs) + +if __name__ == "__main__": + html_out = html_base.replace("${TITLE_HERE}", color_io.input_print("Please enter page title")); + html_out = html_out.replace("${SCRIPT_HERE}", color_io.input_print("Please enter script location and name")); + + bprint(html_out); \ No newline at end of file diff --git a/examples/emscripten.html b/examples/emscripten.html new file mode 100644 index 0000000..1535753 --- /dev/null +++ b/examples/emscripten.html @@ -0,0 +1,173 @@ + + + + + + ${TITLE HERE} + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + diff --git a/util/__pycache__/color_io.cpython-311.pyc b/util/__pycache__/color_io.cpython-311.pyc new file mode 100644 index 0000000..9cbeb1a Binary files /dev/null and b/util/__pycache__/color_io.cpython-311.pyc differ diff --git a/util/color_io.py b/util/color_io.py new file mode 100644 index 0000000..42343bb --- /dev/null +++ b/util/color_io.py @@ -0,0 +1,17 @@ +import sys + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + +def input_print(p, default = ""): + eprint("\033[93m" + p, end=':\033[0m ', flush=True) + inp = input("") + if inp: + return inp + else: + if not default: + return input_print(p, default) + return default + +def green_print(p): + eprint("\033[92m" + p + "\033[0m") \ No newline at end of file