aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-03-27 23:16:17 +0200
committerDaniel Schadt <kingdread@gmx.de>2023-03-27 23:16:17 +0200
commit308e031b1cb0699fb50da5c9bbca091a80de44a1 (patch)
tree560887afe5ecf7b3e64da39d706c55a0ed995596
parentd92ee8d445d1456c4b80b980f8e8a4cb2d9c97fe (diff)
downloadfietsboek-308e031b1cb0699fb50da5c9bbca091a80de44a1.tar.gz
fietsboek-308e031b1cb0699fb50da5c9bbca091a80de44a1.tar.bz2
fietsboek-308e031b1cb0699fb50da5c9bbca091a80de44a1.zip
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.
-rw-r--r--fietsboek/scripts/__init__.py1
-rw-r--r--fietsboek/scripts/fietscron.py9
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.