generated from DuckyMomo20012/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.py
43 lines (30 loc) · 895 Bytes
/
cli.py
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
40
41
42
43
from enum import Enum
from typing import Annotated
import typer
from environs import Env
class Service(str, Enum):
server = "server"
server_mail = "server:mail"
client = "client"
mail = "mail"
env = Env()
# Read .env into os.environ
env.read_env()
def main(
service: Annotated[Service, typer.Argument()] = Service.server,
):
if str(service) == "Service.server":
import src.serverApp.app as serverApp
serverApp.main()
elif str(service) == "Service.server_mail":
print("Starting mail server...")
import src.mailServer.server as server
server.main()
elif str(service) == "Service.mail":
import src.mailApp.app as mailApp
mailApp.main()
elif str(service) == "Service.client":
import src.clientApp.app as clientApp
clientApp.main()
if __name__ == "__main__":
typer.run(main)