From 37ede6572e650508cfe8637e791fb92b1edc98af Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Mon, 27 Apr 2026 06:34:51 -0300 Subject: [PATCH] Add overwrite flag to Database --- gamdl/cli/cli.py | 2 +- gamdl/cli/database.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gamdl/cli/cli.py b/gamdl/cli/cli.py index 00426f4..365aee7 100644 --- a/gamdl/cli/cli.py +++ b/gamdl/cli/cli.py @@ -119,7 +119,7 @@ async def main(config: CliConfig): ) if config.database_path: - database = Database(config.database_path) + database = Database(config.database_path, config.overwrite) flat_filter = database.flat_filter else: database = None diff --git a/gamdl/cli/database.py b/gamdl/cli/database.py index 6a0c874..2e6fce2 100644 --- a/gamdl/cli/database.py +++ b/gamdl/cli/database.py @@ -3,7 +3,13 @@ from pathlib import Path class Database: - def __init__(self, path: Path): + def __init__( + self, + path: Path, + overwrite: bool, + ): + self.overwrite = overwrite + self.connection = sqlite3.connect(path) self.cursor = self.connection.cursor() self._create_tables() @@ -45,4 +51,8 @@ class Database: if not result: return None - return result if Path(result).exists() else None + return ( + "Registered in database" + if Path(result).exists() and not self.overwrite + else None + )