forked from unit/ciclostile
refactor cli interface
This commit is contained in:
parent
7d52b773b9
commit
eccff07b8f
1
setup.py
1
setup.py
|
@ -20,7 +20,6 @@ setup(
|
||||||
entry_points='''
|
entry_points='''
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
ciclostile=cli:cli
|
ciclostile=cli:cli
|
||||||
ciclostile-web=web:cli
|
|
||||||
''',
|
''',
|
||||||
|
|
||||||
install_requires=['Click', 'markdown', 'jinja2', 'flask', 'flask-httpauth']
|
install_requires=['Click', 'markdown', 'jinja2', 'flask', 'flask-httpauth']
|
||||||
|
|
|
@ -9,14 +9,3 @@ app = Flask(__name__)
|
||||||
app.register_blueprint(api, url_prefix="/api")
|
app.register_blueprint(api, url_prefix="/api")
|
||||||
|
|
||||||
app.config['SECRET_KEY'] = 'secret key here'
|
app.config['SECRET_KEY'] = 'secret key here'
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option("-p", "--port", type=int, default=12345)
|
|
||||||
@click.argument("post_dir", default=".")
|
|
||||||
def cli(port, post_dir):
|
|
||||||
app.run(port=port)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
cli()
|
|
|
@ -3,6 +3,8 @@ import sys
|
||||||
import click
|
import click
|
||||||
import ciclostile
|
import ciclostile
|
||||||
|
|
||||||
|
from ciclostile.web import app as webapp
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
def cli():
|
||||||
|
@ -30,5 +32,12 @@ def index(template, output, folder):
|
||||||
output.write(html)
|
output.write(html)
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
@click.option("-p", "--port", type=int, default=12345)
|
||||||
|
@click.argument("post_dir", default=".")
|
||||||
|
def app(port, post_dir):
|
||||||
|
webapp.run(port=port)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli()
|
cli()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user