README.md (view raw)
1# `bibel` - Bible Verse CLI Utility
2
3A Go utility for displaying Bible verses. This tool shows Bible verses based on
4the current date, displaying 12 verses per day through the four Gospels.
5
6## Features
7
8- **Date-Based Progression**: Automatically calculates position based on day of
9year (1 January = Matthew 1:1-12)
10- **Smart Sizing**: Default snippet size is 12 verses, extends to end of
11chapter if less than 12 verses remain
12- **Colour Output**: ANSI color-coded output (green for book/chapter, yellow
13for verse range)
14- **Yearly Cycle**: Progresses through all four Gospels each year, restarting
15on 1 January
16- **Simple CLI**: Run to display today's Bible snippet
17
18## Installation
19
20```bash
21go build ./cmd/bibel.go
22```
23
24## Usage
25
26```bash
27./bibel
28```
29
30The program will:
311. Calculate today's date and day of year
322. Determine Bible position: day_of_year × 12 verses
333. Find corresponding verses in the Gospels
344. Display the Bible snippet with colored headers
35
36No bookmark file is needed or created - the position is calculated from the
37date alone.
38
39## Data Format
40
41The Bible data is in JSON format (`books/pol_nbg.json`) with the following structure:
42```json
43{
44 "metadata": { ... },
45 "verses": [
46 {
47 "book_name": "Mateusza",
48 "book": 40,
49 "chapter": 1,
50 "verse": 1,
51 "text": "¶ KSIĘGA początku Jezusa Chrystusa..."
52 },
53 ...
54 ]
55}
56```
57
58Books 40-43 correspond to the four Gospels:
59- 40: Matthew (Mateusza)
60- 41: Mark (Marek)
61- 42: Luke (Łukasz)
62- 43: John (Jana)
63
64## Date-Based Algorithm
65
66The program calculates reading position as follows:
67
681. **Day of Year**: Get current day number (1-366)
692. **Verse Offset**: Multiply by 12 verses per day: `offset = (day_of_year - 1) × 12`
703. **Modulo Wrap**: Apply modulo with total Gospel verses (3779) to cycle yearly
714. **Position Mapping**: Walk through Gospels to find corresponding verses
725. **Lookahead Rule**: Extend to chapter end if less than 12 verses remain
73
74## Project Structure
75
76```
77.
78├── cmd/bibel.go # Main CLI entry point
79├── internal/bible/
80│ ├── verse.go # Data structures
81│ ├── loader.go # JSON loading and indexing
82│ ├── dateprogression.go # Date-based position calculation
83│ ├── formatter.go # Output formatting
84│ └── bookmark.go # Legacy bookmark management (optional)
85├── books/pol_nbg.json # Bible data
86└── old_code.ml # Original OCaml implementation
87```
88
89## Examples
90
91- **1 January**: Matthew 1:1-12
92- **2 January**: Matthew 1:13-25 (extends to end of chapter)
93- **16 April**: Mark 5:41-43
94- **31 December**: Matthew 18:7-18 (year wraps around)
95
96## Development
97
98```bash
99# Build
100go build ./cmd/bibel.go
101
102# Run with today's date
103./bibel
104
105# Test with specific date (environment variable)
106GOOSE_TEST_DATE=2026-01-01 ./bibel
107```