Skip to content

Commit

Permalink
fix(search): do not display duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Jan 5, 2025
1 parent b6d55e7 commit 44b857b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/poetry/console/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ class SearchCommand(Command):
]

def handle(self) -> int:
seen = set()

for result in self.poetry.pool.search(self.argument("tokens")):
if result.pretty_string in seen:
continue

seen.add(result.pretty_string)

self.line("")
name = f"<info>{result.name}</>"

Expand Down
6 changes: 0 additions & 6 deletions tests/console/commands/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ def test_search_only_legacy_repository(
expected = """
ipython (5.7.0)
ipython (5.7.0)
ipython (5.7.0)
ipython (7.5.0)
ipython (7.5.0)
"""

Expand Down

0 comments on commit 44b857b

Please sign in to comment.