A command-line interface for accessing Quranic verses and translations with elegant formatting and caching capabilities.
- π Random verses: Get random Quranic verses with translations
- π Surah browsing: Access specific surahs and ayahs
- π Multiple translations: Support for various translation options
- πΎ Smart caching: Offline access with configurable TTL
- π¨ Beautiful formatting: Colored console output with Arabic text support
- βοΈ Configurable: User-friendly configuration management
- π± JSON output: Machine-readable output option
pip install gwanicligit clone https://github.com/bhantsi/gwani-cli.git
cd gwani-cli
pip install -e .gwani randomgwani surah 1 # Al-Fatiha
gwani surah "Al-Baqarah" --ayah 255 # Ayat al-Kursigwani config set translation en.sahih
gwani config get translationgwani random --jsonGet a random Quranic verse with translation.
Options:
--translation, -t TEXT: Specify translation (e.g., en.pickthall)--no-cache: Skip cache and fetch fresh data--json: Output in JSON format
Examples:
gwani random
gwani random --translation en.sahih
gwani random --json --no-cacheGwaniCLI provides intelligent Arabic text rendering that automatically adapts to your terminal's capabilities.
Use the global --arabic-mode option to control how Arabic text is displayed:
# Automatic detection (default)
gwani random
# Unicode Arabic text only
gwani --arabic-mode unicode random
# Transliterated text only
gwani --arabic-mode transliteration random
# Both Arabic and transliteration
gwani --arabic-mode both randomCheck your terminal's Arabic support and get font recommendations:
gwani fontsFor optimal Arabic display, consider installing these fonts:
Ubuntu/Debian:
sudo apt install fonts-noto fonts-amiri fonts-scheherazade-newmacOS (with Homebrew):
brew install --cask font-noto-sans-arabic font-amiri font-scheherazade-newRecommended fonts:
- Noto Sans Arabic (comprehensive Unicode support)
- Amiri (traditional Arabic calligraphy)
- Cairo (modern, clean Arabic font)
- Scheherazade New (academic/traditional style)
GwaniCLI works with any terminal:
- Modern terminals (xterm, GNOME Terminal, iTerm2, etc.): Full Unicode Arabic support
- Basic terminals: Automatic fallback to transliteration
- Windows: Enhanced UTF-8 support with automatic optimizations
Get verses from a specific surah by number or name.
Arguments:
identifier: Surah number (1-114) or name (e.g., "Al-Fatiha")
Options:
--ayah, -a INT: Specific ayah number--translation, -t TEXT: Specify translation--no-cache: Skip cache and fetch fresh data--json: Output in JSON format
Examples:
gwani surah 1 # Entire Al-Fatiha
gwani surah 2 --ayah 255 # Ayat al-Kursi
gwani surah "Al-Fatiha" --json # JSON formatCheck Arabic text display capabilities and get font recommendations.
Examples:
gwani fonts # Check terminal capabilities and show font recommendationsThis command will:
- Test your terminal's Arabic text support
- Show terminal and encoding information
- Display sample Arabic text in different modes
- Provide font installation instructions for your platform
Manage configuration settings.
Subcommands:
set <key> <value>: Set a configuration valueget <key>: Get a configuration value
Supported Keys:
translation: Default translation (e.g., en.pickthall)cache_ttl: Cache time-to-live in seconds
Examples:
gwani config set translation en.sahih
gwani config set cache_ttl 3600
gwani config get translationShow version information.
GwaniCLI stores configuration in ~/.config/gwanicli/config.toml.
Default configuration:
translation = "en.pickthall"
cache_ttl = 86400The application caches API responses to improve performance and enable offline access:
- Location:
~/.cache/gwanicli/cache.db - Storage: SQLite database
- TTL: Configurable expiration time
- Management: Automatic cleanup of expired entries
Common translation identifiers:
en.pickthall: Pickthall English translationen.sahih: Sahih Internationalen.yusufali: Abdullah Yusuf Aliar.alafasy: Arabic (Mishary Alafasy)
git clone https://github.com/bhantsi/gwani-cli.git
cd gwani-cli
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"pytestblack qwanicli/
flake8 qwanicli/
mypy qwanicli/qwanicli/
βββ __init__.py # Package initialization
βββ cli.py # Main CLI entry point with Click commands
βββ api_client.py # HTTP client for Quran API
βββ config.py # Configuration management
βββ cache.py # SQLite-based caching layer
βββ formatter.py # Output formatting (console & JSON)
βββ utils.py # Common utilities and error handling
GwaniCLI uses the Al-Quran Cloud API to fetch Quranic content.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Al-Quran Cloud API for providing the Quranic data
- Click for the excellent CLI framework
- The open-source community for various Python packages used
If you encounter any issues or have questions:
Note: This tool is for educational and personal use. Please respect the sacred nature of the Quranic content.