Ramadan CLI offers multiple output modes designed for different use cases, from human-readable terminal output to machine-parsable JSON for scripts and agents.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ahmadawais/ramadan-cli/llms.txt
Use this file to discover all available pages before exploring further.
Default Mode: Rich Terminal Output
Without any output flags, you get a beautifully formatted terminal display:- ASCII art banner
- Color-coded output (green for Ramadan branding)
- Current status with countdown timer
- Row annotations (← current, ← next)
- Footer note explaining time semantics
Plain Text Mode
Use--plain or -p to remove the ASCII banner while keeping the formatted table:
Plain mode is useful when:
- Running in environments where ASCII art doesn’t render well
- You want cleaner, more compact output
- Integrating with tools that parse terminal output
JSON Mode
Use--json or -j to get structured JSON output for scripts and automation:
Success Response
JSON Mode Values
Themode field indicates what data is being returned:
| Mode | Description | When Used |
|---|---|---|
today | Single day (current or first) | Default run without flags |
all | Full 30-day calendar | When using --all flag |
number | Specific roza day | When using --number <1-30> flag |
Full Calendar JSON
Error Response
When an error occurs in JSON mode, the error is written tostderr:
Error Codes
JSON errors include standardized error codes:| Code | Description |
|---|---|
INVALID_FIRST_ROZA_DATE | First roza date is not in YYYY-MM-DD format |
INVALID_FLAG_COMBINATION | Conflicting flags (e.g., --all with --number) |
PRAYER_TIMES_FETCH_FAILED | Failed to fetch prayer times from API |
RAMADAN_CALENDAR_FETCH_FAILED | Failed to fetch Ramadan calendar |
LOCATION_DETECTION_FAILED | Could not detect location |
ROZA_NOT_FOUND | Specified roza number not found |
RAMADAN_CLI_ERROR | General CLI error |
UNKNOWN_ERROR | Unexpected error |
Exit codes:
0 for success, 1 for any error conditionStatus Line Mode
Use--status or -s for a single-line output showing the next event. Perfect for status bars, shell prompts, and coding agents:
Example Outputs
Before Sehar:Status Line Logic
The status line is generated by thegetHighlightState() function:
- Hours and minutes:
6h 12m - Minutes only (under 1 hour):
45m - Days, hours, minutes:
15d 8h 25m
Status Line with City
Use Cases for Status Line
- Shell Prompt
- Tmux Status Bar
- Waybar/Polybar
- AI Agents
Add Ramadan countdown to your shell prompt:
Silent Failures
Status mode fails silently (no output) if:- Location cannot be detected
- API request fails
- No configuration exists and interactive setup is skipped
This prevents status bars from showing error messages. Use
roza without flags to diagnose issues.JSON Mode Behavior
Non-Interactive
When using--json, the CLI skips interactive setup:
I/O Streams
Combining Output Modes with Other Flags
Plain + All
JSON + Number
JSON + City + Custom Date
Output Mode Precedence
You cannot combine certain output modes:Color Output
Default and plain modes use terminal colors:- Green (
ramadanGreen): Headers, status labels - Yellow: Countdown times, “next” annotations
- White: Data values
- Dim/Gray: Table borders, footer notes
src/ui/theme.ts:
Practical Examples
Script Integration
Desktop Notification
CSV Export
Related Features
- Ramadan Calendar - View full month or specific days
- Location Detection - How location affects output
- Custom First Roza - Using custom dates with different outputs