Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/update-aur.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ jobs:
sed -i 's/pkgver=.*/pkgver=${{ steps.get_version.outputs.version }}/' PKGBUILD
sed -i 's|source=.*|source=("$pkgname-$pkgver.tar.gz::https://github.com/Matars/gitfetch/archive/refs/tags/v$pkgver.tar.gz")|' PKGBUILD
sed -i "s/sha256sums=.*/sha256sums=('${{ steps.sha256.outputs.sha256 }}')/" PKGBUILD
# Update dependencies
sed -i 's/depends=.*/depends=("python-requests" "python-readchar")/' PKGBUILD
- name: Update .SRCINFO
run: |
cd aur-repo
sed -i 's/pkgver = .*/pkgver = ${{ steps.get_version.outputs.version }}/' .SRCINFO
sed -i 's|source = .*|source = gitfetch-python-${{ steps.get_version.outputs.version }}.tar.gz::https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz|' .SRCINFO
sed -i "s/sha256sums = .*/sha256sums = ${{ steps.sha256.outputs.sha256 }}/" .SRCINFO
# Update dependencies in .SRCINFO
sed -i 's/depends = python-requests/depends = python-requests\n\tdepends = python-readchar/' .SRCINFO
- name: Commit and push
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update-homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
sed -i 's|url "https://github.com/Matars/gitfetch/archive/refs/tags/v.*"|url "https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz"|' homebrew-tap/Formula/gitfetch.rb
sed -i 's|version ".*"|version "${{ steps.get_version.outputs.version }}"|' homebrew-tap/Formula/gitfetch.rb
sed -i 's|sha256 ".*"|sha256 "${{ steps.sha256.outputs.sha256 }}"|' homebrew-tap/Formula/gitfetch.rb
# Update dependencies
sed -i 's|depends_on "requests"|depends_on "requests"\n depends_on "readchar"|' homebrew-tap/Formula/gitfetch.rb

- name: Commit and push
run: |
Expand Down
138 changes: 35 additions & 103 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gitfetch

A neofetch-style CLI tool for GitHub statistics. Display your GitHub profile and stats in a beautiful, colorful terminal interface.
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.

<img width="3024" height="1964" alt="image" src="https://github.com/user-attachments/assets/bbb18d5d-4787-4998-a352-e8f4e59642c0" />

Expand All @@ -9,41 +9,33 @@ A neofetch-style CLI tool for GitHub statistics. Display your GitHub profile and
## Features

- Neofetch-style display with ASCII art
- Comprehensive GitHub statistics
- Comprehensive statistics from multiple git hosting platforms
- Smart SQLite-based caching system for faster subsequent runs
- Persistent configuration with default username support
- Uses GitHub CLI (gh) for authentication - no rate limits!
- Cross-platform support (macOS and Linux)
- First-run initialization with interactive setup
- First-run initialization with interactive provider selection

## Prerequisites
## Supported Platforms

**GitHub CLI (gh) must be installed and authenticated:**
- **GitHub** - Uses GitHub CLI (gh) for authentication
- **GitLab** - Uses GitLab CLI (glab) for authentication
- **Gitea/Forgejo/Codeberg** - Uses personal access tokens
- **Sourcehut** - Uses personal access tokens

See installation instructions at: https://github.com/cli/cli#installation
## Installation

### macOS
`gitfetch` can be installed without any prerequisites. During first-run setup, you'll be guided to install and authenticate with the necessary CLI tools or provide access tokens for your chosen git hosting platform.

```bash
brew install gh
gh auth login
```

### Linux

Then authenticate:

```bash
gh auth login
```
## First-run Setup

### Verify Installation
When you run `gitfetch` for the first time, you'll be prompted to:

```bash
gh auth status
```
1. **Choose your git hosting provider** (GitHub, GitLab, Gitea/Forgejo/Codeberg, or Sourcehut)
2. **Install required CLI tools** (if using GitHub or GitLab)
3. **Authenticate** with your chosen platform
4. **Configure access tokens** (if using Gitea/Forgejo/Codeberg or Sourcehut)

You should see: `✓ Logged in to github.com as YOUR_USERNAME`
The setup process will provide helpful error messages and installation instructions if anything is missing.

## Installing `gitfetch`

Expand Down Expand Up @@ -165,107 +157,47 @@ gh auth status

Configuration file location: `~/.config/gitfetch/gitfetch.conf`

The configuration file is automatically created on first run and contains two main sections:
The configuration file is automatically created on first run. See `docs/providers.md` for detailed provider configuration and `docs/colors.md` for color customization options.

### [DEFAULT] Section

```ini
[DEFAULT]
username = yourusername
cache_expiry_hours = 24
provider = github
provider_url = https://api.github.com
```

- `username`: Your default GitHub username (automatically set from authenticated GitHub CLI user)
- `username`: Your default username (automatically detected)
- `cache_expiry_hours`: How long to keep cached data (default: 24 hours)
- `provider`: Git hosting provider (github, gitlab, gitea, sourcehut)
- `provider_url`: API URL for the provider

### [COLORS] Section

gitfetch supports extensive color customization. All colors use ANSI escape codes.
gitfetch supports extensive color customization. All colors use ANSI escape codes. See `docs/colors.md` for detailed color configuration options.

````ini
```ini
[COLORS]
reset = \033[0m
bold = \033[1m
dim = \033[2m
red = \033[91m
green = \033[92m
yellow = \033[93m
blue = \033[94m
magenta = \033[95m
cyan = \033[96m
white = \033[97m
orange = \033[38;2;255;165;0m
accent = \033[1m
header = \033[38;2;118;215;161m
muted = \033[2m
0 = \033[48;5;238m
1 = \033[48;5;28m
2 = \033[48;5;34m
3 = \033[48;5;40m
4 = \033[48;5;82m
```

#### Color Reference

- **Text Styles**:

- `reset`: Reset all formatting
- `bold`: Bold text
- `dim`: Dimmed text
- `accent`: Accent styling (bold)

- **Basic Colors**:

- `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`: Standard ANSI colors
- `orange`: Custom orange color

- **UI Elements**:

- `header`: Section headers and main display text
- `muted`: Separators and underlines

- **Contribution Graph**:
- `0`: No contributions (lightest)
- `1`: 1-2 contributions
- `2`: 3-6 contributions
- `3`: 7-12 contributions
- `4`: 13+ contributions (darkest)

#### Customizing Colors

To change colors, edit `~/.config/gitfetch/gitfetch.conf` and modify the ANSI escape codes:

**Example: Change header color to blue**

```ini
header = \033[94m
```

**Example: Change contribution graph colors to a purple theme**

```ini
0 = \033[48;5;235m # Dark gray for no contributions
1 = \033[48;5;60m # Dark purple
2 = \033[48;5;62m # Medium purple
3 = \033[48;5;64m # Light purple
4 = \033[48;5;66m # Bright purple
```
# ... color definitions ...
````

**Common ANSI Color Codes**:
See `docs/colors.md` for detailed color configuration options and customization examples.

- `\033[91m` = Bright Red
- `\033[92m` = Bright Green
- `\033[93m` = Bright Yellow
- `\033[94m` = Bright Blue
- `\033[95m` = Bright Magenta
- `\033[96m` = Bright Cyan
- `\033[97m` = Bright White
## Supported Providers

**Background Colors** (for contribution blocks):
gitfetch supports multiple Git hosting platforms:

- `\033[48;5;{color_code}m` where color_code is 0-255 (256-color palette)
- **GitHub** - Uses GitHub CLI (gh) for authentication
- **GitLab** - Uses GitLab CLI (glab) for authentication
- **Gitea/Forgejo/Codeberg** - Direct API access with personal access tokens
- **Sourcehut** - Direct API access with personal access tokens

Changes take effect immediately - no restart required.
See `docs/providers.md` for detailed setup instructions for each provider.

## Caching

Expand Down
65 changes: 65 additions & 0 deletions docs/colors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Color Configuration

gitfetch uses ANSI color codes for terminal output. Colors can be customized in the `[COLORS]` section of the config file.

## Available Colors

The following color keys can be customized:

### Text Formatting

- `reset`: Reset all formatting
- `bold`: Bold text
- `dim`: Dimmed text

### Basic Colors

- `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`

### Special Colors

- `orange`: Orange color
- `accent`: Accent color for highlights
- `header`: Header text color
- `muted`: Muted text color

### Contribution Graph Colors (0-4)

- `0`: Lowest contribution level
- `1`: Low contribution level
- `2`: Medium contribution level
- `3`: High contribution level
- `4`: Highest contribution level

## Configuration

Colors use ANSI escape codes. Examples:

```ini
[COLORS]
reset = \033[0m
bold = \033[1m
red = \033[91m
green = \033[92m
blue = \033[94m
header = \033[38;2;118;215;161m
0 = \033[48;5;238m
1 = \033[48;5;28m
```

## ANSI Color Codes

- `\033[0m`: Reset
- `\033[1m`: Bold
- `\033[2m`: Dim
- `\033[91m`: Bright Red
- `\033[92m`: Bright Green
- `\033[93m`: Bright Yellow
- `\033[94m`: Bright Blue
- `\033[95m`: Bright Magenta
- `\033[96m`: Bright Cyan
- `\033[97m`: Bright White

For 256-color codes, use `\033[38;5;{color_code}m` for foreground or `\033[48;5;{color_code}m` for background.

For RGB colors, use `\033[38;2;{r};{g};{b}m` for foreground or `\033[48;2;{r};{g};{b}m` for background.
47 changes: 47 additions & 0 deletions docs/providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Git Providers

gitfetch supports multiple Git hosting providers. Configure your preferred provider in the config file.

## Supported Providers

### GitHub

- **provider**: `github`
- **provider_url**: `https://api.github.com`
- **Requirements**: GitHub CLI (`gh`) must be installed and authenticated
- **Authentication**: Run `gh auth login`

### GitLab

- **provider**: `gitlab`
- **provider_url**: `https://gitlab.com`
- **Requirements**: GitLab CLI (`glab`) must be installed and authenticated
- **Authentication**: Run `glab auth login`

### Gitea/Forgejo/Codeberg

- **provider**: `gitea`
- **provider_url**: Custom URL (e.g., `https://codeberg.org`, `https://gitea.com`)
- **Requirements**: None (uses API directly)
- **Authentication**: Set personal access token in environment or use CLI tools

### Sourcehut

- **provider**: `sourcehut`
- **provider_url**: `https://git.sr.ht`
- **Requirements**: None (uses API directly)
- **Authentication**: Set personal access token in environment

## Configuration

Set the provider and URL in your `gitfetch.conf`:

```ini
[DEFAULT]
provider = github
provider_url = https://api.github.com
```

## Adding New Providers

To add support for a new Git provider, implement a new fetcher class in `fetcher.py` and update the provider selection logic in `cli.py`.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "gitfetch"
version = "1.0.20"
version = "1.1.0"
description = "A neofetch-style CLI tool for GitHub statistics"
readme = "README.md"
requires-python = ">=3.8"
Expand All @@ -27,7 +27,8 @@ classifiers = [
]

dependencies = [
"requests>=2.0.0"
"requests>=2.0.0",
"readchar>=4.0.0"
]

[project.optional-dependencies]
Expand All @@ -50,6 +51,9 @@ Issues = "https://github.com/Matars/gitfetch/issues"
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
gitfetch = ["docs/*.md"]

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# No Python dependencies required
# Requires GitHub CLI (gh) to be installed and authenticated
requests>=2.0.0
readchar>=4.0.0
Loading