forked from Boris-code/feapder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdline.py
More file actions
56 lines (45 loc) · 1.24 KB
/
cmdline.py
File metadata and controls
56 lines (45 loc) · 1.24 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
"""
Created on 2020/5/8 2:24 PM
---------
@summary:
---------
@author: Boris
@email: boris_liu@foxmail.com
"""
import sys
from os.path import dirname, join
from feapder.commands import create_builder
from feapder.commands import shell
from feapder.commands import zip
def _print_commands():
with open(join(dirname(dirname(__file__)), "VERSION"), "rb") as f:
version = f.read().decode("ascii").strip()
print("feapder {}".format(version))
print("\nUsage:")
print(" feapder <command> [options] [args]\n")
print("Available commands:")
cmds = {
"create": "create project、spider、item and so on",
"shell": "debug response",
"zip": "zip project",
}
for cmdname, cmdclass in sorted(cmds.items()):
print(" %-13s %s" % (cmdname, cmdclass))
print('\nUse "feapder <command> -h" to see more info about a command')
def execute():
args = sys.argv
if len(args) < 2:
_print_commands()
return
command = args.pop(1)
if command == "create":
create_builder.main()
elif command == "shell":
shell.main()
elif command == "zip":
zip.main()
else:
_print_commands()
if __name__ == "__main__":
execute()