From 508144eb087eab76bb20d9f7148de3b10ef0a968 Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Wed, 10 Feb 2021 19:26:15 +0100 Subject: [PATCH] Add cli pattern --- app/cli.py | 6 ++++++ pdc_web.py | 10 ++++++++-- pytest.ini | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/cli.py diff --git a/app/cli.py b/app/cli.py new file mode 100644 index 0000000..14b49b9 --- /dev/null +++ b/app/cli.py @@ -0,0 +1,6 @@ + +def register(app): + @app.cli.group() + def pdc_tools(): + """pdc default cli group""" + pass diff --git a/pdc_web.py b/pdc_web.py index 38b7595..976303c 100644 --- a/pdc_web.py +++ b/pdc_web.py @@ -1,11 +1,17 @@ # # Flask app wrapper # -from app import create_app - +from app import create_app, cli # # Use app factory with configuration set by FLASK_ENV # see app/__init_.py/create_app() for more details. # pdc_app = create_app() + +# +# Declare command line interpreter +# used with 'flask aroma_db' command +# see aroma/cli.py for more details. +# +cli.register(pdc_app) diff --git a/pytest.ini b/pytest.ini index 4a1c45f..efd815c 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,4 +3,4 @@ testpaths = tests python_files = *_tests.py log_level = INFO log_cli = True -console_output_style = classic \ No newline at end of file +console_output_style = classic -- libgit2 0.21.2