From 308e031b1cb0699fb50da5c9bbca091a80de44a1 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 27 Mar 2023 23:16:17 +0200 Subject: use fietsboek.ini as default config This makes it easy to use the scripts without always having to specify -c. The error message could be a bit better if fietsboek.ini is not found and -c is not given, maybe we can fix that later. --- fietsboek/scripts/__init__.py | 1 + fietsboek/scripts/fietscron.py | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fietsboek/scripts/__init__.py b/fietsboek/scripts/__init__.py index ea36d96..c7bbe98 100644 --- a/fietsboek/scripts/__init__.py +++ b/fietsboek/scripts/__init__.py @@ -12,6 +12,7 @@ config_option = click.option( "--config", type=click.Path(exists=True, dir_okay=False), required=True, + default="fietsboek.ini", help="Path to the Fietsboek configuration file", ) diff --git a/fietsboek/scripts/fietscron.py b/fietsboek/scripts/fietscron.py index a142f39..6a8f293 100644 --- a/fietsboek/scripts/fietscron.py +++ b/fietsboek/scripts/fietscron.py @@ -9,6 +9,7 @@ from sqlalchemy import create_engine, delete, exists, not_, select from sqlalchemy.engine import Engine from sqlalchemy.orm import Session +from . import config_option from .. import config as mod_config from .. import models from ..data import DataManager @@ -17,13 +18,7 @@ LOGGER = logging.getLogger(__name__) @click.command() -@click.option( - "-c", - "--config", - type=click.Path(exists=True, dir_okay=False), - required=True, - help="Path to the Fietsboek configuration file", -) +@config_option def cli(config): """Runs regular maintenance operations on the instance. -- cgit v1.2.3