Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): set max terminal width based on terminal #817

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/deptry/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import logging
import shutil
import sys
from collections import defaultdict
from importlib.metadata import version
Expand Down Expand Up @@ -240,7 +241,7 @@
is_flag=True,
help="Enable experimental support for namespace package (PEP 420) when detecting local modules (https://peps.python.org/pep-0420/).",
)
def deptry(
def cli(
root: tuple[Path, ...],
config: Path,
no_ansi: bool,
Expand Down Expand Up @@ -290,3 +291,9 @@
pep621_dev_dependency_groups=pep621_dev_dependency_groups,
experimental_namespace_package=experimental_namespace_package,
).run()


def deptry() -> None:
column_size, _line_size = shutil.get_terminal_size()

Check warning on line 297 in python/deptry/cli.py

View check run for this annotation

Codecov / codecov/patch

python/deptry/cli.py#L297

Added line #L297 was not covered by tests

cli(max_content_width=column_size)

Check warning on line 299 in python/deptry/cli.py

View check run for this annotation

Codecov / codecov/patch

python/deptry/cli.py#L299

Added line #L299 was not covered by tests
4 changes: 2 additions & 2 deletions tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from click.testing import CliRunner

from deptry.cli import deptry
from deptry.cli import cli
from tests.functional.utils import Project
from tests.utils import get_issues_report, stylize

Expand Down Expand Up @@ -625,6 +625,6 @@ def test_cli_with_json_output(poetry_venv_factory: PoetryVenvFactory) -> None:


def test_cli_help() -> None:
result = CliRunner().invoke(deptry, "--help")
result = CliRunner().invoke(cli, "--help")

assert result.exit_code == 0
Loading