#!/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);