Skip to content

Commit 1cca12e

Browse files
committed
feat: updated cli
1 parent 5528f41 commit 1cca12e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

crawlab_ai/cli/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import argparse
22

3-
from crawlab_ai.cli.gen_code import setup_gen_code_parser
3+
from crawlab_ai.cli.codegen import setup_codegen_parser
44
from crawlab_ai.cli.config import setup_config_parser
55
from crawlab_ai.cli.crawl import setup_crawl_parser
66

77
parser = argparse.ArgumentParser(description="Web scraping tool")
88
subparsers = parser.add_subparsers(dest="command")
99

1010
setup_crawl_parser(subparsers)
11-
setup_gen_code_parser(subparsers)
11+
setup_codegen_parser(subparsers)
1212
setup_config_parser(subparsers)
1313

1414

crawlab_ai/cli/gen_code.py renamed to crawlab_ai/cli/codegen.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
from crawlab_ai.utils.auth import get_token
44

55

6-
def setup_gen_code_parser(subparsers):
7-
gen_code_parser = subparsers.add_parser(
6+
def setup_codegen_parser(subparsers):
7+
codegen_parser = subparsers.add_parser(
88
"gen_code", help="Generate crawler code for a webpage"
99
)
10-
gen_code_parser.add_argument("url", help="URL to generate code for")
11-
gen_code_parser.add_argument(
10+
codegen_parser.add_argument("url", help="URL to generate code for")
11+
codegen_parser.add_argument(
1212
"-t",
1313
"--type",
1414
help="Type of the webpage to generate code for",
1515
default="list",
1616
choices=["article", "list"],
1717
)
18-
gen_code_parser.add_argument("-o", "--output", help="Output file path")
19-
gen_code_parser.set_defaults(func=gen_code)
18+
codegen_parser.add_argument("-o", "--output", help="Output file path")
19+
codegen_parser.set_defaults(func=codegen)
2020

2121

22-
def gen_code(args):
22+
def codegen(args):
2323
get_token()
2424
if args.type == "list":
25-
gen_code_list(args)
25+
codegen_list(args)
2626
elif args.type == "article":
27-
gen_code_article(args)
27+
codegen_article(args)
2828

2929

30-
def gen_code_list(args):
30+
def codegen_list(args):
3131
code = get_code_list(args.url)
3232
if args.output:
3333
with open(args.output, "w") as f:
@@ -36,7 +36,7 @@ def gen_code_list(args):
3636
print(code)
3737

3838

39-
def gen_code_article(args):
39+
def codegen_article(args):
4040
code = get_code_article(args.url)
4141
if args.output:
4242
with open(args.output, "w") as f:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="crawlab-ai",
5-
version="0.0.4",
5+
version="0.0.5",
66
packages=find_packages(),
77
url="https://github.com/crawlab-team/crawlab-ai-sdk",
88
license="MIT",

0 commit comments

Comments
 (0)