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
45 lines (36 loc) · 1.07 KB
/
cmdline.py
File metadata and controls
45 lines (36 loc) · 1.07 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
# -*- 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
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"}
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()
else:
_print_commands()