A beautiful command-line tool to fetch and display README files from GitHub repositories with syntax highlighting and rich formatting.
- π¨ Beautiful Rendering: Markdown rendering with syntax-highlighted code blocks
- π Flexible Search: Access your own or any public repository
- π Multiple Themes: Choose from 40+ syntax highlighting themes
- π Repository Info: Display comprehensive repository metadata
- π Private Repos: Support for private repositories with authentication
- β‘ Fast: Direct API access without cloning repositories
- π― CLI Ready: Production-ready command-line interface
- Installation
- Quick Start
- Usage
- Authentication
- Examples
- Available Themes
- API Usage
- Contributing
- License
pip install PyGithub richgit clone https://github.com/cumulus13/gitinfo.git
cd gitinfo
pip install -r requirements.txtCreate a requirements.txt file:
PyGithub>=2.0.0
rich>=13.0.0# View README from any public repository
python gitinfo.py torvalds/linux
# View README from your own repository (requires authentication)
export GITHUB_TOKEN="your_github_token_here"
python gitinfo.py myrepo --ownpython gitinfo.py <repository> [options]| Option | Short | Description |
|---|---|---|
repository |
- | Repository name (username/repo or just repo for own repos) |
--token |
-t |
GitHub Personal Access Token |
--own |
- | Indicate this is your own repository |
--private |
- | Indicate this is a private repository |
--no-readme |
- | Skip displaying README, only show repository info |
--no-info |
- | Skip displaying repository info, only show README |
--theme |
- | Syntax highlighting theme (default: monokai) |
--verbose |
-v |
Enable verbose output |
--rate-limit |
- | Show GitHub API rate limit information |
--version |
- | Show version information |
--help |
-h |
Show help message |
- Access private repositories
- Higher API rate limits (5,000 vs 60 requests/hour)
- Access your own repositories
- Go to GitHub Settings β Developer Settings β Personal Access Tokens
- Click "Generate new token (classic)"
- Give it a name and select scopes:
repo- Full control of private repositoriespublic_repo- Access public repositories
- Click "Generate token" and copy it
Method 1: Environment Variable (Recommended)
export GITHUB_TOKEN="ghp_your_token_here"
python gitinfo.py myrepo --ownMethod 2: Command-Line Argument
python gitinfo.py myrepo --own --token "ghp_your_token_here"Method 3: Add to your shell profile
Add to ~/.bashrc or ~/.zshrc:
export GITHUB_TOKEN="ghp_your_token_here"python gitinfo.py torvalds/linuxpython gitinfo.py my-awesome-project --ownpython gitinfo.py my-private-repo --own --privatepython gitinfo.py python/cpython --theme draculapython gitinfo.py microsoft/vscode --no-infopython gitinfo.py facebook/react --no-readmepython gitinfo.py psf/requests --verbose --rate-limitfor repo in torvalds/linux python/cpython microsoft/vscode; do
python gitinfo.py $repo
echo "---"
doneThe tool supports all Pygments themes. Popular choices include:
monokai(default) - Dark, vibrant colorsdracula- Dark theme with purple accentsgithub-dark- GitHub's dark themenord- Arctic, north-bluish color palettesolarized-dark- Popular dark themematerial- Material Design inspiredvim- Classic Vim colorsfruity- Colorful and brightnative- Similar to VSCode defaultone-dark- Atom's One Dark theme
Try different themes:
python gitinfo.py username/repo --theme <theme-name>You can also use the tool as a Python library:
from gitinfo import GitHubReadmeFinder
# Initialize
finder = GitHubReadmeFinder(access_token="your_token")
# Find README
detail_repo, readme_content = finder.find_readme(
"torvalds/linux",
own=False,
public=True
)
# Display repository info
finder.display_repo_info(detail_repo)
# Display README with custom theme
if readme_content:
finder.display_readme(
readme_content,
detail_repo['full_name'],
"README.md",
theme="dracula"
)
# Check rate limits
finder.show_rate_limit()from gitinfo import GitHubReadmeFinder
import json
# Initialize with verbose mode
finder = GitHubReadmeFinder(
access_token="your_token",
verbose=True
)
# Get multiple repositories
repos = ["python/cpython", "torvalds/linux", "microsoft/vscode"]
for repo_name in repos:
detail, readme = finder.find_readme(repo_name, own=False)
# Save to file
if readme:
filename = f"{repo_name.replace('/', '_')}_README.md"
with open(filename, 'w') as f:
f.write(readme)
# Save metadata as JSON
with open(f"{repo_name.replace('/', '_')}_info.json", 'w') as f:
json.dump(detail, f, indent=2)The tool displays:
- Repository name and full name
- Description
- URL
- Visibility (Public/Private)
- Stars and forks count
- Primary language
- Default branch
- Last commit information
- Automatic markdown rendering
- Syntax-highlighted code blocks
- Support for
.md,.rst,.txtfiles - Customizable color themes
- Check repository name format:
username/repo - Verify repository exists and is public
- For private repos, ensure you have access and provided token
- Set your GitHub token via
GITHUB_TOKENenvironment variable - Or use
--tokenargument
- Without authentication: 60 requests/hour
- With authentication: 5,000 requests/hour
- Use
--rate-limitto check current usage
pip install PyGithub richContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
git clone https://github.com/cumulus13/gitinfo.git
cd gitinfo
pip install -r requirements-dev.txtpytest tests/This project is licensed under the MIT License - see the LICENSE file for details.
- PyGithub - Python library for GitHub API
- Rich - Beautiful terminal formatting
- Pygments - Syntax highlighting
cumulus13 - @cumulus13
Project Link: https://github.com/cumulus13/gitinfo
If you find this project useful, please consider giving it a star!
Made with β€οΈ and Python

