-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (31 loc) · 1.08 KB
/
main.py
File metadata and controls
39 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
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
35
36
37
38
39
import argparse
from tkinter import filedialog
from tkinter import Tk
from api_server import Component
from env import Environment
from web_init import init_web
from web_server import ApiServer
def main(args):
read_path = args.dest
if read_path is None:
root = Tk()
root.withdraw()
read_path = filedialog.askdirectory()
root.destroy()
if read_path == "":
print("No directory selected")
return
env = Environment({}, read_path=read_path)
inited = init_web(env, args.quasarbuild)
api_server: ApiServer = inited[0]
instantiated_components: list[Component] = inited[1]
api_server.run(host=args.host, port=args.port)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=5000)
parser.add_argument("--host", type=str, default="127.0.0.1")
parser.add_argument("--dest", type=str, default=None)
parser.add_argument("--quasarbuild", type=str, default="public/dist/spa")
return parser.parse_args()
if __name__ == '__main__':
main(parse_args())