all repos — bibel @ 0be549fc2abddcf0f0e574436c2607ed7f844ab0

Unnamed repository; edit this file 'description' to name the repository.

README.md (view raw)

  1# `bibel` - Bible Verse CLI/TUI Utility
  2
  3A Go utility for displaying Bible verses with interactive terminal interface.
  4This tool shows Bible verses based on the current date, displaying 12 verses
  5per day through the four Gospels.
  6
  7## Features
  8
  9- **Interactive TUI**: Terminal User Interface using `bubbletea` with styled boxes
 10- **Date-Based Progression**: Automatically calculates position based on day of
 11year (1 January = Matthew 1:1-12)
 12- **Smart Sizing**: Default snippet size is 12 verses, extends to end of
 13chapter if less than 12 verses remain
 14- **Adaptive Styling**: Terminal-adaptive colours and borders using `lipgloss`
 15- **Interactive Controls**: Press `q` to quit (MOTD-like behaviour)
 16- **Yearly Cycle**: Progresses through all four Gospels each year, restarting
 17on 1 January
 18- **Multiple Output Modes**: Interactive TUI, formatted ANSI, or plain text
 19
 20## Installation
 21
 22```bash
 23go build ./cmd/bibel.go
 24```
 25
 26## Usage
 27
 28```bash
 29./bibel
 30```
 31
 32The program will:
 331. Calculate today's date and day of year
 342. Determine Bible position: day_of_year × 12 verses
 353. Find corresponding verses in the Gospels
 364. Display the Bible snippet with colored headers
 37
 38No bookmark file is needed or created - the position is calculated from the
 39date alone.
 40
 41## Data Format
 42
 43The Bible data is in JSON format (`books/pol_nbg.json`) with the following structure:
 44```json
 45{
 46  "metadata": { ... },
 47  "verses": [
 48    {
 49      "book_name": "Mateusza",
 50      "book": 40,
 51      "chapter": 1,
 52      "verse": 1,
 53      "text": "¶ KSIĘGA początku Jezusa Chrystusa..."
 54    },
 55    ...
 56  ]
 57}
 58```
 59
 60Books 40-43 correspond to the four Gospels:
 61- 40: Matthew (Mateusza)
 62- 41: Mark (Marek)
 63- 42: Luke (Łukasz)
 64- 43: John (Jana)
 65
 66## Date-Based Algorithm
 67
 68The program calculates reading position as follows:
 69
 701. **Day of Year**: Get current day number (1-366)
 712. **Verse Offset**: Multiply by 12 verses per day: `offset = (day_of_year - 1) × 12`
 723. **Modulo Wrap**: Apply modulo with total Gospel verses (3779) to cycle yearly
 734. **Position Mapping**: Walk through Gospels to find corresponding verses
 745. **Lookahead Rule**: Extend to chapter end if less than 12 verses remain
 75
 76## Project Structure
 77
 78```
 79.
 80├── cmd/bibel.go                 # Main CLI entry point
 81├── internal/
 82│   ├── bible/                   # Core Bible functionality
 83│   │   ├── verse.go             # Data structures
 84│   │   ├── loader.go            # JSON loading and indexing
 85│   │   ├── dateprogression.go   # Date-based position calculation
 86│   │   └── formatter.go         # Output formatting
 87│   └── tui/                     # Terminal User Interface
 88│       └── model.go             # bubbletea TUI model and styling
 89├── books/pol_nbg.json           # Bible data
 90├── go.mod                       # Go module dependencies
 91├── go.sum                       # Go dependency checksums
 92└── old_code.ml                  # Original OCaml implementation
 93```
 94
 95## Examples
 96
 97- **1 January**: Matthew 1:1-12
 98- **2 January**: Matthew 1:13-25 (extends to end of chapter)
 99- **16 April**: Mark 5:41-43
100- **31 December**: Matthew 18:7-18 (year wraps around)
101
102## Development
103
104```bash
105# Build
106go build ./cmd/bibel.go
107
108# Run
109./bibel
110```