refactor cli interface

This commit is contained in:
subnixr 2018-04-24 18:09:02 +02:00
parent 7d52b773b9
commit eccff07b8f
4 changed files with 9 additions and 12 deletions

View File

@ -20,7 +20,6 @@ setup(
entry_points='''
[console_scripts]
ciclostile=cli:cli
ciclostile-web=web:cli
''',
install_requires=['Click', 'markdown', 'jinja2', 'flask', 'flask-httpauth']

View File

@ -9,14 +9,3 @@ app = Flask(__name__)
app.register_blueprint(api, url_prefix="/api")
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()

View File

@ -3,6 +3,8 @@ import sys
import click
import ciclostile
from ciclostile.web import app as webapp
@click.group()
def cli():
@ -30,5 +32,12 @@ def index(template, output, folder):
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__":
cli()