This commit is contained in:
Christopher Pickering 2021-09-28 13:42:13 +02:00
parent 8f78e1964b
commit b00e51488a
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
9 changed files with 16 additions and 14 deletions

View file

@ -12,7 +12,7 @@
project = "djlint"
copyright = "2021, Riverside Healthcare"
author = "Christopher Pickering"
release = "0.4.3"
release = "0.4.4"
version = release
# -- General configuration ---------------------------------------------------

View file

@ -1,6 +1,10 @@
Changelog
=========
0.4.4
-----
- Change indent config from string to int. ``--indent 3``
0.4.3
-----
- Added cli option for indent spacing. ``--indent=" "``

View file

@ -44,13 +44,13 @@ Usage:
indent
------
Use to change the code indentation. Default is four spaces.
Use to change the code indentation. Default is 4 (four spaces).
Usage:
.. code:: toml
indent = " " # change indentation level
indent = 3 # change indentation level
exclude
-------

View file

@ -58,7 +58,7 @@ CLI Args
Options:
-e, --extension TEXT File extension to lint [default: html]
-i, --ignore "Codes" Rules to be ignored. ex: "W013,W014"
--indent Indent spacing.
--indent Indent spacing. ex: 3
--reformat Reformat the file(s).
--check Check formatting on the file(s).
--quiet Do not print diff when reformatting.

View file

@ -7,7 +7,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name="djlint"
version="0.4.3"
version="0.4.4"
description="HTML Template Linter and Formatter"
license="GPL-3.0-or-later"
authors=["Christopher Pickering <cpickering@rhc.net>"]

View file

@ -186,8 +186,8 @@ def build_quantity_tense(size: int) -> str:
)
@click.option(
"--indent",
type=str,
help="Indent spacing.",
type=int,
help="Indent spacing. ex: 3",
)
@click.option(
"--quiet",
@ -199,7 +199,7 @@ def main(
extension: str,
ignore: str,
reformat: bool,
indent: Optional[str],
indent: Optional[int],
check: bool,
quiet: bool,
) -> None:

View file

@ -59,7 +59,7 @@ class Config:
src: str,
ignore: Optional[str] = None,
extension: Optional[str] = None,
indent: Optional[str] = None,
indent: Optional[int] = None,
quiet: Optional[bool] = False,
):
@ -74,7 +74,7 @@ class Config:
)
# base options
self.indent: str = str(indent or djlint_settings.get("indent", " "))
self.indent: str = (indent or int(djlint_settings.get("indent", 4))) * " "
print(len(self.indent))
default_exclude: str = r"""

View file

@ -1,3 +1,3 @@
[tool]
[tool.djlint]
indent = " "
indent = 2

View file

@ -64,9 +64,7 @@ def test_indent(runner: CliRunner) -> None:
)
assert result.exit_code == 1
result = runner.invoke(
djlint, ["tests/config_indent", "--check", "--indent", " "]
)
result = runner.invoke(djlint, ["tests/config_indent", "--check", "--indent", 3])
assert (
"""-<section><p><div><span></span></div></p></section>