-
Notifications
You must be signed in to change notification settings - Fork 8
/
bottle_boilerplate.py
60 lines (50 loc) · 1.58 KB
/
bottle_boilerplate.py
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
57
58
59
60
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from cookiecutter.main import cookiecutter
@click.group()
def cmds():
pass
@cmds.command()
@click.argument('project_name', type=str)
def startproject(project_name):
click.echo(u'Bottle Boilerplate start new project...')
repo_name = project_name.lower().replace(' ', '-')
app_name = repo_name.replace("-", "")
extra_context = {
'project_name': project_name,
"repo_name": repo_name,
"app_name": app_name,
"pkg_name": app_name
}
cookiecutter(
'https://github.com/avelino/cookiecutter-bottle.git',
no_input=True,
extra_context=extra_context)
@cmds.command()
@click.argument('project_name', type=str)
def sample(project_name):
click.echo(u'Bottle Boilerplate start new sample project...')
repo_name = project_name.lower().replace(' ', '-')
app_name = repo_name.replace("-", "")
extra_context = {
'project_name': project_name,
"repo_name": repo_name,
"app_name": app_name,
"pkg_name": app_name
}
cookiecutter(
'https://github.com/avelino/cookiecutter-bottle-sample.git',
no_input=True,
extra_context=extra_context)
@cmds.command()
@click.option('--version', type=str, default="dev",
help=u'Set version to search!')
def doc(version):
if version not in ["dev", "0.12", "0.11", "0.10", "0.9"]:
version = "dev"
url = 'http://bottlepy.org/docs/{}/'.format(version)
click.launch(url)
click.echo(u'Bottle Boilerplate start browser!')
def main():
cmds()