Skip to content

Commit 776bc6b

Browse files
committed
fixed PR's section fetching issues
1 parent d68b635 commit 776bc6b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "gitfetch"
7-
version = "1.0.14"
7+
version = "1.0.15"
88
description = "A neofetch-style CLI tool for GitHub statistics"
99
readme = "README.md"
1010
requires-python = ">=3.8"

src/gitfetch/fetcher.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,17 @@ def _calculate_language_stats(self, repos: list) -> Dict[str, float]:
232232
def _search_items(self, query: str, per_page: int = 5) -> Dict[str, Any]:
233233
"""Search issues and PRs using GitHub CLI search command."""
234234
try:
235+
# Determine search type based on query
236+
search_type = 'prs' if 'is:pr' in query else 'issues'
237+
238+
# Remove is:pr/issue from query as it's implied by search type
239+
query = query.replace('is:pr ', '').replace('is:issue ', '')
240+
235241
# Parse query string and convert to command-line flags
236242
flags = self._parse_search_query(query)
237243

238244
# Build command with proper flags
239-
cmd = ['gh', 'search', 'issues'] + flags + [
245+
cmd = ['gh', 'search', search_type] + flags + [
240246
'--limit', str(per_page),
241247
'--json', 'number,title,repository,url,state'
242248
]
@@ -293,9 +299,9 @@ def _parse_search_query(self, query: str) -> list:
293299
flags.extend(['--state', value])
294300
elif key == 'is':
295301
# Handle is:pr and is:issue
296-
if value == 'pr':
297-
flags.append('--include-prs')
298-
# is:issue is default, no flag needed
302+
# For prs search, we don't need this flag
303+
# For issues search, is:issue is default
304+
pass
299305
else:
300306
# For other qualifiers, add as search term
301307
flags.append(part)

0 commit comments

Comments
 (0)