Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: better names for cli modules

NTFSvolume908a8afd6025
diff --git a/cyberdrop_dl/cli.py b/cyberdrop_dl/cli.py
index 95d5b8493..7958d7969 100644
--- a/cyberdrop_dl/cli.py
+++ b/cyberdrop_dl/cli.py
@@ -8,11 +8,10 @@ from cyclopts.help import DefaultFormatter
from cyberdrop_dl import __version__
from cyberdrop_dl.commands import CLIarguments
-from cyberdrop_dl.commands.clean_up import app as cleanup
-from cyberdrop_dl.commands.config import app as config
-from cyberdrop_dl.commands.database import app as database
+from cyberdrop_dl.commands.cleanup import app as cleanup_app
+from cyberdrop_dl.commands.config import app as config_app
+from cyberdrop_dl.commands.database import app as database_app
from cyberdrop_dl.commands.hash import compute_hashes
-from cyberdrop_dl.commands.report import report
from cyberdrop_dl.commands.scrape import download, prepare_manager, scrape
app = App(
@@ -51,13 +50,21 @@ def main_menu(
@app.command
def show() -> None:
"""Show a list of all supported sites"""
- from cyberdrop_dl import supported_sites
+ from cyberdrop_dl.commands import supported_sites
table = supported_sites.as_rich_table()
app.console.print(table)
-for cmd in download, database, cleanup, report, config:
+def report() -> None:
+ """Generate and display information about the system"""
+ from cyberdrop_dl.commands.report import generate_report
+
+ app.console.print(generate_report())
+
+
+for cmd in download, database_app, cleanup_app, config_app:
app.command(cmd)
diff --git a/cyberdrop_dl/commands/compat.py b/cyberdrop_dl/commands/_compat.py
similarity index 100%
rename from cyberdrop_dl/commands/compat.py
rename to cyberdrop_dl/commands/_compat.py
diff --git a/cyberdrop_dl/commands/clean_up.py b/cyberdrop_dl/commands/cleanup.py
similarity index 100%
rename from cyberdrop_dl/commands/clean_up.py
rename to cyberdrop_dl/commands/cleanup.py
diff --git a/cyberdrop_dl/commands/hash.py b/cyberdrop_dl/commands/hash.py
index 922d49d89..54fe16a8f 100644
--- a/cyberdrop_dl/commands/hash.py
+++ b/cyberdrop_dl/commands/hash.py
@@ -3,7 +3,7 @@ from typing import Literal
from cyclopts.types import ResolvedExistingDirectory
from cyberdrop_dl.commands import CLIarguments
-from cyberdrop_dl.commands.compat import check_for_v9_files
+from cyberdrop_dl.commands._compat import check_for_v9_files
from cyberdrop_dl.config import Config
diff --git a/cyberdrop_dl/commands/report.py b/cyberdrop_dl/commands/report.py
index 56ad353b8..c1b945efd 100644
--- a/cyberdrop_dl/commands/report.py
+++ b/cyberdrop_dl/commands/report.py
@@ -45,10 +45,5 @@ def generate_report() -> str:
)
-def report() -> None:
- """Generate and display information about the system"""
- print(generate_report()) # noqa: T201
-
-
if __name__ == "__main__":
- report()
+ print(generate_report()) # noqa: T201
diff --git a/cyberdrop_dl/commands/scrape.py b/cyberdrop_dl/commands/scrape.py
index 76f88e81d..28e9422bf 100644
--- a/cyberdrop_dl/commands/scrape.py
+++ b/cyberdrop_dl/commands/scrape.py
@@ -9,7 +9,7 @@ from cyclopts import Parameter
from cyclopts.group import Group
from cyberdrop_dl.commands import CLIarguments
-from cyberdrop_dl.commands.compat import check_for_v9_files
+from cyberdrop_dl.commands._compat import check_for_v9_files
from cyberdrop_dl.config import Config
from cyberdrop_dl.config.appdata import AppData
from cyberdrop_dl.exceptions import CDLConfigRuntimeErrorsGroup
diff --git a/cyberdrop_dl/supported_sites.py b/cyberdrop_dl/commands/supported_sites.py
similarity index 100%
rename from cyberdrop_dl/supported_sites.py
rename to cyberdrop_dl/commands/supported_sites.py
diff --git a/scripts/tools/update_docs.py b/scripts/tools/update_docs.py
index 79875ce5a..5e9e08f93 100644
--- a/scripts/tools/update_docs.py
+++ b/scripts/tools/update_docs.py
@@ -1,6 +1,7 @@
from pathlib import Path
-from cyberdrop_dl import __version__, supported_sites
+from cyberdrop_dl import __version__
+from cyberdrop_dl.commands import supported_sites
from cyberdrop_dl.constants import CDL_USER_AGENT
REPO_ROOT = Path(__file__).parents[2]
@@ -43,7 +44,7 @@ def _replace_content(text: str, marker: str, new_content: str) -> str:
def _get_help_message() -> str:
from rich.console import Console
- from cyberdrop_dl.__main__ import app
+ from cyberdrop_dl.cli import app
with Console(record=True, width=100) as console:
app.help_print([], console=console)
diff --git a/tests/test_supported_sites.py b/tests/test_supported_sites.py
index 1a55f0ae0..ae40cd864 100644
--- a/tests/test_supported_sites.py
+++ b/tests/test_supported_sites.py
@@ -1,4 +1,4 @@
-from cyberdrop_dl.supported_sites import as_markdown, as_rich_table
+from cyberdrop_dl.commands.supported_sites import as_markdown, as_rich_table
def test_rich_table() -> None: