Merge branch 'master' of github.com:Riverside-Healthcare/djlint

This commit is contained in:
Christopher Pickering 2021-09-17 09:43:42 +02:00
commit b9d1fe5e7a
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 9 additions and 1 deletions

View file

@ -62,3 +62,4 @@ CLI Args
--check Check formatting on the file(s).
--quiet Do not print diff when reformatting.
-h, --help Show this message and exit.
--version Get djLint version

View file

@ -151,6 +151,7 @@ def build_quantity_tense(size: int) -> str:
nargs=1,
metavar="SRC ...",
)
@click.version_option(package_name="djlint")
@click.option(
"-e",
"--extension",

View file

@ -7,7 +7,7 @@ run::
for a single test::
pytest tests/test_djlint.py::test_W010 --cov=src/djlint \
pytest tests/test_djlint.py::test_version --cov=src/djlint \
--cov-branch --cov-report xml:coverage.xml --cov-report term-missing
or::
@ -19,6 +19,7 @@ or::
from pathlib import Path
from typing import TextIO
import pkg_resources
from click.testing import CliRunner
from src.djlint import main as djlint
@ -136,3 +137,8 @@ def test_check_reformatter_no_error(runner: CliRunner, tmp_file: TextIO) -> None
result = runner.invoke(djlint, [tmp_file.name, "--check"])
assert result.exit_code == 0
assert "0 files would be updated." in result.output
def test_version(runner: CliRunner) -> None:
result = runner.invoke(djlint, ["--version"])
assert pkg_resources.get_distribution("djlint").version in result.output