README.md (view raw)
1# `bibel` - Bible Verse CLI Utility
2
3A Go reimplementation of an OCaml utility for displaying Bible verses. This
4tool reads a bookmark file and displays a snippet of Bible text (typically 12
5verses), then updates the bookmark for the next run.
6
7## Features
8
9- **Progressive Reading**: Automatically advances through the first four books
10of the New Testament (Matthew, Mark, Luke, John)
11- **Smart Sizing**: Default snippet size is 12 verses, extends to end of
12chapter if less than 12 verses remain
13- **Bookmark Persistence**: Saves reading position in a TOML file
14- **Color Output**: ANSI color-coded output (green for book/chapter, yellow for
15verse range)
16- **Simple CLI**: Run once to display current snippet and advance bookmark
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. Read the current bookmark from `bookmark.toml` (creates default if not
32 exists)
332. Display the Bible snippet for that bookmark with colored headers
343. Calculate and save the next bookmark
35
36## Data Format
37
38The Bible data is in JSON format (`books/pol_nbg.json`) with the following structure:
39```json
40{
41 "metadata": { ... },
42 "verses": [
43 {
44 "book_name": "Mateusza",
45 "book": 40,
46 "chapter": 1,
47 "verse": 1,
48 "text": "¶ KSIĘGA początku Jezusa Chrystusa..."
49 },
50 ...
51 ]
52}
53```
54
55Books 40-43 correspond to the Evangelion:
56- 40: Matthew (Mateusza)
57- 41: Mark (Marek)
58- 42: Luke (Łukasz)
59- 43: John (Jana)
60
61## Bookmark Format
62
63The bookmark file (`bookmark.toml`) uses TOML format:
64```toml
65book = 40 # Book index (40-43)
66chapter = 1 # Chapter number
67first_verse = 1 # First verse in range
68second_verse = 12 # Last verse in range
69```
70
71## Project Structure
72
73```
74.
75├── cmd/bibel.go # Main CLI entry point
76├── internal/bible/
77│ ├── verse.go # Data structures
78│ ├── loader.go # JSON loading and indexing
79│ ├── bookmark.go # Bookmark management
80│ └── formatter.go # Output formatting
81├── books/pol_nbg.json # Bible data
82└── old_code.ml # Original OCaml implementation
83```
84
85## Logic Details
86
87- **Advancement**: After displaying verses 1-12, next bookmark is 13-24 (or to
88end of chapter)
89- **Chapter Boundaries**: At chapter end, moves to next chapter in same book
90- **Book Boundaries**: At book end, moves to next book (loops from John back to
91Matthew)
92- **Lookahead Rule**: If less than 12 verses remain after current snippet,
93extends current snippet to end of chapter
94
95## Development
96
97```bash
98# Build
99go build ./cmd/bibel.go
100
101# Run with current bookmark
102./bibel
103
104# Reset bookmark to Matthew 1:1-12
105echo 'book = 40
106chapter = 1
107first_verse = 1
108second_verse = 12' > bookmark.toml
109```
110
111## License
112
113See the original Bible data for copyright information. The code is open source.