Skip to content

Commit eacbf7d

Browse files
committed
(ignore) squash test commits
1 parent dfded09 commit eacbf7d

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# gitfetch
22

3+
[![CI](https://github.com/Matars/gitfetch/actions/workflows/ci.yml/badge.svg)](https://github.com/Matars/gitfetch/actions/workflows/ci.yml)
4+
35
A neofetch-style CLI tool for GitHub, GitLab, Gitea, Forgejo, Codeberg, and Sourcehut statistics. Display your profile and stats from various git hosting platforms in a beautiful, colorful terminal interface with extensive customization options and intelligent layout adaptation.
46

57
> **Note**: This project is still maturing with only ~20 closed issues as of October 26, 2025. If you encounter bugs, have feature requests, or want to contribute, please [open an issue](https://github.com/Matars/gitfetch/issues).

docs/installation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ nixos-rebuild switch
9494

9595
### With pip
9696

97+
Make sure you have pip installed, then run:
98+
9799
```bash
98100
git clone https://github.com/Matars/gitfetch.git
99101
cd gitfetch
100-
pip install -e .
102+
make dev
101103
```
102104

103105
### With uv

src/gitfetch/cache.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@
1212
class CacheManager:
1313
"""Manages local caching of GitHub data using SQLite."""
1414

15-
CACHE_DIR = Path.home() / ".local" / "share" / "gitfetch"
16-
DB_FILE = CACHE_DIR / "cache.db"
17-
18-
def __init__(self, cache_expiry_minutes: int = 15):
15+
def __init__(self, cache_expiry_minutes: int = 15,
16+
cache_dir: Optional[Path] = None):
1917
"""
2018
Initialize the cache manager.
2119
2220
Args:
2321
cache_expiry_minutes: Minutes before cache expires (default: 15)
22+
cache_dir: Directory to store cache files
23+
(default: ~/.local/share/gitfetch)
2424
"""
2525
self.cache_expiry_minutes = cache_expiry_minutes
26+
self.CACHE_DIR = cache_dir or (
27+
Path.home() / ".local" / "share" / "gitfetch")
28+
self.DB_FILE = self.CACHE_DIR / "cache.db"
2629
self._ensure_cache_dir()
2730
self._init_database()
2831

tests/test_cache.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ class TestCacheManager:
1515
def setup_method(self):
1616
"""Set up test fixtures."""
1717
self.temp_dir = tempfile.mkdtemp()
18-
with patch('src.gitfetch.cache.CacheManager.CACHE_DIR',
19-
Path(self.temp_dir)):
20-
self.cache_manager = CacheManager(cache_expiry_minutes=15)
18+
self.cache_manager = CacheManager(
19+
cache_expiry_minutes=15, cache_dir=Path(self.temp_dir))
2120

2221
def teardown_method(self):
2322
"""Clean up test fixtures."""
@@ -60,10 +59,9 @@ def test_stale_cache_retrieval(self):
6059

6160
def test_cache_minutes_parameter(self):
6261
"""Test that cache_expiry_minutes parameter works."""
63-
with patch('src.gitfetch.cache.CacheManager.CACHE_DIR',
64-
Path(self.temp_dir)):
65-
cache_manager = CacheManager(cache_expiry_minutes=30)
66-
assert cache_manager.cache_expiry_minutes == 30
62+
cache_manager = CacheManager(
63+
cache_expiry_minutes=30, cache_dir=Path(self.temp_dir))
64+
assert cache_manager.cache_expiry_minutes == 30
6765

6866
def test_cache_timestamp_update(self):
6967
"""Test that caching updates the timestamp."""

0 commit comments

Comments
 (0)