-
Notifications
You must be signed in to change notification settings - Fork 520
Expand file tree
/
Copy pathcli.py
More file actions
41 lines (29 loc) · 874 Bytes
/
cli.py
File metadata and controls
41 lines (29 loc) · 874 Bytes
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
import argparse
import sys
from .. import WarpCore, templates
def template_init(args):
return """'
""".strip()
def init_template(args):
parser = argparse.ArgumentParser(description="WarpCore template init tool")
parser.add_argument("-t", "--template", type=str, default="WarpCore")
args = parser.parse_args(args)
if args.template == "WarpCore":
template_cls = WarpCore
else:
try:
template_cls = __import__(args.template)
except ModuleNotFoundError:
template_cls = getattr(templates, args.template)
print(template_cls)
def main():
if len(sys.argv) < 2:
print("Usage: core <command>")
sys.exit(1)
if sys.argv[1] == "init":
init_template(sys.argv[2:])
else:
print("Unknown command")
sys.exit(1)
if __name__ == "__main__":
main()