forked from scrapinghub/shub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool.py
More file actions
52 lines (41 loc) · 1.21 KB
/
Copy pathtool.py
File metadata and controls
52 lines (41 loc) · 1.21 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
from __future__ import absolute_import
import importlib
import click
import shub
from shub.utils import update_available
HELP = """
shub is the Scrapinghub command-line client. It allows you to deploy projects
or dependencies, schedule spiders, and retrieve scraped data or logs without
leaving the command line.
"""
SHORT_HELP = "Scrapinghub command-line client"
EPILOG = """
For usage and help on a specific command, run it with a --help flag, e.g.:
shub schedule --help
"""
@click.group(help=HELP, short_help=SHORT_HELP, epilog=EPILOG)
@click.version_option(shub.__version__)
def cli():
update_url = update_available()
if update_url:
click.echo("INFO: A newer version of shub is available. Update "
"via pip or get it at {}".format(update_url), err=True)
commands = [
"deploy",
"login",
"deploy_egg",
"fetch_eggs",
"deploy_reqs",
"logout",
"version",
"items",
"schedule",
"log",
"requests",
"copy_eggs"
]
for command in commands:
module_path = "shub." + command
command_module = importlib.import_module(module_path)
command_name = command.replace('_', '-') # easier to type
cli.add_command(command_module.cli, command_name)