From a7a6df3fb162deb6889e6d836eeb581a0aa7af82 Mon Sep 17 00:00:00 2001 From: oliverlaslett Date: Thu, 9 Sep 2021 13:41:15 +0100 Subject: [PATCH] add version flag to cli --- dbt2looker/cli.py | 9 +++++++++ poetry.lock | 8 ++++---- pyproject.toml | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dbt2looker/cli.py b/dbt2looker/cli.py index 4f06ed4..f9f0cb9 100644 --- a/dbt2looker/cli.py +++ b/dbt2looker/cli.py @@ -3,6 +3,10 @@ import logging import pathlib import os +try: + from importlib.metadata import version +except ImportError: + from importlib_metadata import version import yaml try: @@ -64,6 +68,11 @@ def get_dbt_project_config(prefix: str): def run(): argparser = argparse.ArgumentParser() + argparser.add_argument( + '--version', + action='version', + version=f'dbt2looker {version("dbt2looker")}', + ) argparser.add_argument( '--target', help='Path to dbt target directory containing manifest.json and catalog.json.', diff --git a/poetry.lock b/poetry.lock index 3c2b801..de1acfa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -14,7 +14,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> [[package]] name = "importlib-metadata" -version = "4.7.1" +version = "4.8.1" description = "Read metadata from Python packages" category = "main" optional = false @@ -117,7 +117,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = ">=3.7" -content-hash = "90a71b76cb95ddbd5be00a367f8772b13f120cbca3d13195cdd6f68bdac35125" +content-hash = "b21396f6d527f8f2261664935fcfb04face23be82ce27f36ffc1b9cc89eea5be" [metadata.files] attrs = [ @@ -125,8 +125,8 @@ attrs = [ {file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.7.1-py3-none-any.whl", hash = "sha256:9e04bf59076a15a9b6dd9c27806e8fcdf15280ba529c6a8cc3f4d5b4875bdd61"}, - {file = "importlib_metadata-4.7.1.tar.gz", hash = "sha256:c4eb3dec5f697682e383a39701a7de11cd5c02daf8dd93534b69e3e6473f6b1b"}, + {file = "importlib_metadata-4.8.1-py3-none-any.whl", hash = "sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15"}, + {file = "importlib_metadata-4.8.1.tar.gz", hash = "sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1"}, ] jsonschema = [ {file = "jsonschema-3.2.0-py2.py3-none-any.whl", hash = "sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163"}, diff --git a/pyproject.toml b/pyproject.toml index 9f42f0a..b1c4fa6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dbt2looker" -version = "0.7.2" +version = "0.7.3" description = "Generate lookml view files from dbt models" authors = ["oliverlaslett "] license = "MIT" @@ -15,6 +15,7 @@ pydantic = "^1.8.1" PyYAML = "^5.4.1" jsonschema = "^3.2.0" typing-extensions = "^3.10.0" +importlib-metadata = "^4.8.1" [tool.poetry.dev-dependencies]