Skip to content

Commit

Permalink
Implement CLI entrypoint (#4)
Browse files Browse the repository at this point in the history
Implement CLI entrypoint:
* Add lint command
  • Loading branch information
druzhinin-kirill authored Mar 5, 2024
1 parent cba523e commit 7647ddf
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 70 deletions.
90 changes: 20 additions & 70 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [

dependencies = [
"dbt-core>=1.5",
"click>=7.1.1, <9.0.0",
]
requires-python = ">=3.10"
readme = "README.md"
Expand Down Expand Up @@ -47,6 +48,9 @@ docs = [
[tool.pdm.version]
source = "scm"

[tool.pdm.scripts]
dbt-score = {call = "dbt_score.cli:cli"}

### Mypy ###

[tool.mypy]
Expand All @@ -71,6 +75,7 @@ extend-select = [
"PL", # pylint
"Q", # flake8-quotes
"RUF", # ruff
"D", # pycodestyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
]
Expand Down
9 changes: 9 additions & 0 deletions src/dbt_score/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Entry point of the dbt_score.
This enables module to be run directly.
"""

from dbt_score.cli import cli

if __name__ == "__main__":
cli()
34 changes: 34 additions & 0 deletions src/dbt_score/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""CLI interface."""

from typing import Final

import click
from dbt.cli.options import MultiOption

BANNER: Final[str] = r"""
__ __ __
____/ // /_ / /_ _____ _____ ____ _____ ___
/ __ // __ \ / __/______ / ___// ___// __ \ / ___// _ \
/ /_/ // /_/ // /_ /_____/(__ )/ /__ / /_/ // / / __/
\__,_//_.___/ \__/ /____/ \___/ \____//_/ \___/
"""


@click.version_option(message="%(version)s")
@click.group(help=f"\b{BANNER}", invoke_without_command=False)
def cli() -> None:
"""CLI entrypoint."""


@cli.command()
@click.option(
"--select",
"-s",
help="Specify the nodes to include.",
cls=MultiOption,
type=tuple,
multiple=True,
)
def lint(select: tuple[str]) -> None:
"""Lint dbt models metadata."""
raise NotImplementedError()

0 comments on commit 7647ddf

Please sign in to comment.