Skip to main content
Ramadan CLI offers multiple output modes designed for different use cases, from human-readable terminal output to machine-parsable JSON for scripts and agents.

Default Mode: Rich Terminal Output

Without any output flags, you get a beautifully formatted terminal display:
This mode includes:
  • 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

The mode field indicates what data is being returned:

Full Calendar JSON

Error Response

When an error occurs in JSON mode, the error is written to stderr:

Error Codes

JSON errors include standardized error codes:
Exit codes: 0 for success, 1 for any error condition

Status 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:
During Sehar window:
During fasting:
After Iftar:
Before Ramadan:

Status Line Logic

The status line is generated by the getHighlightState() function:
The countdown format:
  • 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

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:
If no configuration exists, it attempts automatic location detection.

I/O Streams

Combining Output Modes with Other Flags

Plain + All

Clean table output with all 30 days.

JSON + Number

JSON + City + Custom Date

Get structured data for a specific city with custom Ramadan dates.

Output Mode Precedence

You cannot combine certain output modes:
Only use one output mode flag at a time: --json, --status, or --plain. If multiple are provided, the behavior is:
  1. --status (highest priority)
  2. --json
  3. --plain

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
Colors are defined in src/ui/theme.ts:
JSON and status modes never include color codes.

Practical Examples

Script Integration

Desktop Notification

CSV Export