forked from LmeSzinc/StarRailCopilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.py
55 lines (43 loc) · 1.19 KB
/
installer.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
44
45
46
47
48
49
50
51
52
53
54
55
import argparse
import sys
import typing as t
sys.stdout.reconfigure(encoding='utf-8')
sys.stderr.reconfigure(encoding='utf-8')
"""
Alas installer
"""
def run_install():
from deploy.installer import run
run()
def run_print_test():
from deploy.Windows.installer_test import run
run()
def run_set(modify=t.List[str]) -> t.Dict[str, str]:
data = {}
for kv in modify:
if "=" in kv:
key, value = kv.split('=', maxsplit=1)
data[key] = value
from deploy.set import config_set
return config_set(data)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Alas installer")
parser.add_argument(
"--print-test",
help="To print example installer outputs instead of making an actual installation",
action="store_true",
)
parser.add_argument(
"--set",
help="Use key=value format to modify config/deploy.yaml\n"
"Example: python installer.py --set Branch=dev",
type=str,
nargs="*",
)
args, _ = parser.parse_known_args()
if args.set:
run_set(args.set)
elif args.print_test:
run_print_test()
else:
run_install()