From a525b676ebd6d1ce35807c6e98ab694c835e8793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Dudzi=C5=84ski?= Date: Sun, 9 Nov 2025 17:14:57 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20`omit=5Fcache`=20and=20`deb?= =?UTF-8?q?ug`=20options=20from=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tiddl/cli/app.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tiddl/cli/app.py b/tiddl/cli/app.py index 8df5f22..96dd70f 100644 --- a/tiddl/cli/app.py +++ b/tiddl/cli/app.py @@ -1,8 +1,9 @@ import typer import logging from rich.console import Console +from typing_extensions import Annotated -from tiddl.cli.config import APP_PATH +from tiddl.cli.config import APP_PATH, CONFIG from tiddl.cli.ctx import ContextObject, Context from tiddl.cli.commands import register_commands @@ -13,7 +14,21 @@ register_commands(app) @app.callback() -def callback(ctx: Context, omit_cache: bool = False, debug: bool = False): +def callback( + ctx: Context, + OMIT_CACHE: Annotated[ + bool, + typer.Option( + "--omit-cache", + ), + ] = not CONFIG.enable_cache, + DEBUG: Annotated[ + bool, + typer.Option( + "--debug", + ), + ] = CONFIG.debug, +): """ tiddl - download tidal tracks \u266b @@ -23,11 +38,11 @@ def callback(ctx: Context, omit_cache: bool = False, debug: bool = False): log.debug(f"{ctx.params=}") - if debug: + if DEBUG: debug_path = APP_PATH / "api_debug" else: debug_path = None ctx.obj = ContextObject( - api_omit_cache=omit_cache, console=Console(), debug_path=debug_path + api_omit_cache=OMIT_CACHE, console=Console(), debug_path=debug_path )