diff --git a/pyproject.toml b/pyproject.toml index d118aad..c0eafdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ packages = [ ] [tool.poetry.scripts] -glvd = 'glvd.cli.__main__:main' +glvd-data = 'glvd.cli.data.__main__:main' [tool.poetry.dependencies] python = ">=3.11" diff --git a/src/glvd/cli/data/__init__.py b/src/glvd/cli/data/__init__.py new file mode 100644 index 0000000..6ff305b --- /dev/null +++ b/src/glvd/cli/data/__init__.py @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT + +from __future__ import annotations + +from ..registry import CliRegistry + + +cli = CliRegistry() diff --git a/src/glvd/cli/__main__.py b/src/glvd/cli/data/__main__.py similarity index 100% rename from src/glvd/cli/__main__.py rename to src/glvd/cli/data/__main__.py diff --git a/src/glvd/cli/combine_all.py b/src/glvd/cli/data/combine_all.py similarity index 98% rename from src/glvd/cli/combine_all.py rename to src/glvd/cli/data/combine_all.py index 23f0955..605c30e 100644 --- a/src/glvd/cli/combine_all.py +++ b/src/glvd/cli/data/combine_all.py @@ -16,7 +16,7 @@ create_async_engine, ) -from ..database import Base, AllCve +from glvd.database import Base, AllCve from . import cli diff --git a/src/glvd/cli/combine_deb.py b/src/glvd/cli/data/combine_deb.py similarity index 98% rename from src/glvd/cli/combine_deb.py rename to src/glvd/cli/data/combine_deb.py index e5dd376..6aa6372 100644 --- a/src/glvd/cli/combine_deb.py +++ b/src/glvd/cli/data/combine_deb.py @@ -21,9 +21,9 @@ create_async_engine, ) -from ..database import Base, DistCpe, DebCve -from ..data.cpe import Cpe, CpeOtherDebian -from ..data.cvss import CvssSeverity +from glvd.database import Base, DistCpe, DebCve +from glvd.data.cpe import Cpe, CpeOtherDebian +from glvd.data.cvss import CvssSeverity from . import cli diff --git a/src/glvd/cli/ingest_debsec.py b/src/glvd/cli/data/ingest_debsec.py similarity index 96% rename from src/glvd/cli/ingest_debsec.py rename to src/glvd/cli/data/ingest_debsec.py index 7838708..4a04f8b 100644 --- a/src/glvd/cli/ingest_debsec.py +++ b/src/glvd/cli/data/ingest_debsec.py @@ -14,9 +14,9 @@ create_async_engine, ) -from ..database import Base, DistCpe, DebsecCve -from ..data.debsec_cve import DebsecCveFile -from ..data.dist_cpe import DistCpeMapper +from glvd.database import Base, DistCpe, DebsecCve +from glvd.data.debsec_cve import DebsecCveFile +from glvd.data.dist_cpe import DistCpeMapper from . import cli diff --git a/src/glvd/cli/ingest_debsrc.py b/src/glvd/cli/data/ingest_debsrc.py similarity index 96% rename from src/glvd/cli/ingest_debsrc.py rename to src/glvd/cli/data/ingest_debsrc.py index cd99300..a3283bc 100644 --- a/src/glvd/cli/ingest_debsrc.py +++ b/src/glvd/cli/data/ingest_debsrc.py @@ -14,9 +14,9 @@ create_async_engine, ) -from ..database import Base, DistCpe, Debsrc -from ..data.debsrc import DebsrcFile -from ..data.dist_cpe import DistCpeMapper +from glvd.database import Base, DistCpe, Debsrc +from glvd.data.debsrc import DebsrcFile +from glvd.data.dist_cpe import DistCpeMapper from . import cli diff --git a/src/glvd/cli/ingest_nvd.py b/src/glvd/cli/data/ingest_nvd.py similarity index 98% rename from src/glvd/cli/ingest_nvd.py rename to src/glvd/cli/data/ingest_nvd.py index 813075e..a4d3cac 100644 --- a/src/glvd/cli/ingest_nvd.py +++ b/src/glvd/cli/data/ingest_nvd.py @@ -15,8 +15,8 @@ create_async_engine, ) -from ..database import Base, NvdCve -from ..util import requests +from glvd.database import Base, NvdCve +from glvd.util import requests from . import cli diff --git a/src/glvd/cli/__init__.py b/src/glvd/cli/registry.py similarity index 98% rename from src/glvd/cli/__init__.py rename to src/glvd/cli/registry.py index 0fe5d52..32c9221 100644 --- a/src/glvd/cli/__init__.py +++ b/src/glvd/cli/registry.py @@ -16,7 +16,7 @@ class _ActionWrapper: kw: dict -class Cli: +class CliRegistry: parser: argparse.ArgumentParser subparsers: argparse._SubParsersAction @@ -78,6 +78,3 @@ def main(self) -> None: func(**v) else: self.parser.print_help() - - -cli = Cli() diff --git a/tests/cli/test_combine_deb.py b/tests/cli/data/test_combine_deb.py similarity index 99% rename from tests/cli/test_combine_deb.py rename to tests/cli/data/test_combine_deb.py index 1c1a715..798e29a 100644 --- a/tests/cli/test_combine_deb.py +++ b/tests/cli/data/test_combine_deb.py @@ -4,7 +4,7 @@ from sqlalchemy import select -from glvd.cli.combine_deb import CombineDeb +from glvd.cli.data.combine_deb import CombineDeb from glvd.data.cvss import CvssSeverity from glvd.data.dist_cpe import DistCpeMapper from glvd.database import DistCpe, DebCve, DebsecCve, Debsrc, NvdCve diff --git a/tests/cli/test_ingest_debsec.py b/tests/cli/data/test_ingest_debsec.py similarity index 98% rename from tests/cli/test_ingest_debsec.py rename to tests/cli/data/test_ingest_debsec.py index e65abb4..8d79983 100644 --- a/tests/cli/test_ingest_debsec.py +++ b/tests/cli/data/test_ingest_debsec.py @@ -4,7 +4,7 @@ from sqlalchemy import select -from glvd.cli.ingest_debsec import IngestDebsec +from glvd.cli.data.ingest_debsec import IngestDebsec from glvd.database import DebsecCve from glvd.data.debsec_cve import DebsecCveFile diff --git a/tests/cli/test_ingest_debsrc.py b/tests/cli/data/test_ingest_debsrc.py similarity index 97% rename from tests/cli/test_ingest_debsrc.py rename to tests/cli/data/test_ingest_debsrc.py index 1044c2c..7e86374 100644 --- a/tests/cli/test_ingest_debsrc.py +++ b/tests/cli/data/test_ingest_debsrc.py @@ -4,7 +4,7 @@ from sqlalchemy import select -from glvd.cli.ingest_debsrc import IngestDebsrc +from glvd.cli.data.ingest_debsrc import IngestDebsrc from glvd.database import Debsrc from glvd.data.debsrc import DebsrcFile diff --git a/tests/cli/test_ingest_nvd.py b/tests/cli/data/test_ingest_nvd.py similarity index 97% rename from tests/cli/test_ingest_nvd.py rename to tests/cli/data/test_ingest_nvd.py index 6f6124f..12888af 100644 --- a/tests/cli/test_ingest_nvd.py +++ b/tests/cli/data/test_ingest_nvd.py @@ -2,7 +2,7 @@ from sqlalchemy import select -from glvd.cli.ingest_nvd import IngestNvd +from glvd.cli.data.ingest_nvd import IngestNvd from glvd.database import NvdCve