all repos — bibel @ 24fb7ab0d94eef6e9a9dab5d2553b861096d5889

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
 10boxes
 11- **Date-Based Progression**: Automatically calculates position based on day of
 12year (1 January = Matthew 1:1-12)
 13- **Smart Sizing**: Default snippet size is 12 verses, extends to end of
 14chapter if less than 12 verses remain
 15- **Adaptive Styling**: Terminal-adaptive colours and borders using `lipgloss`
 16- **Interactive Controls**: Press `q` to quit (MOTD-like behaviour)
 17- **Yearly Cycle**: Progresses through all four Gospels each year, restarting
 18on 1 January
 19- **Multiple Output Modes**: Interactive TUI, formatted ANSI, or plain text
 20
 21## Installation
 22
 23```bash
 24go build ./cmd/bibel.go
 25```
 26
 27## Usage
 28
 29```bash
 30./bibel
 31```
 32
 33By default, the verses the program picks are done by:
 341. Calculating today's date and day of year
 352. Determining Bible position: day of year * 12 verses
 363. Find corresponding verses in the Gospels
 37
 38This is default behaviour. Alternative configurations are available (see
 39below).
 40
 41## Configuration
 42
 43`bibel` supports configuration via a TOML file located at
 44`$XDG_CONFIG_HOME/bibel/config.toml` (default: `~/.config/bibel/config.toml`).
 45Default macOS and Windows paths are also supported.
 46
 47### Configuration Options
 48
 49- **reading_mode**: Reading mode: "evangelion" (four Gospels; *default*),
 50"new_testament", "old_testament", "bible" (default: "evangelion")
 51- **output_mode**: Output mode: "tui" (interactive terminal UI), "formatted"
 52(ANSI-coloured text), or "plain" (plain text)
 53- **bible_path**: Path to Bible data file (default: "books/pol_nbg.json")
 54
 55#### TUI Settings (`[tui]` section)
 56- **show_quit_message**: Whether to show "Press q to quit..." message (default:
 57true)
 58- **border_style**: Box border style: "rounded", "double", "single", or
 59"hidden" (default: "rounded")
 60- **border_colour**: Box border colour (hex or named colour, empty for
 61adaptive)
 62- **header_colour**: Header text colour (empty for adaptive)
 63- **text_colour**: Bible text colour (empty for adaptive)
 64- **quit_colour**: Quit message colour (empty for adaptive)
 65
 66#### Formatter Settings (`[formatter]` section)
 67- **use_colours**: Whether to use ANSI colours in formatted output (default:
 68true)
 69- **header_format**: Header format template with variables: {book}, {chapter},
 70{first_verse}, {second_verse}
 71
 72#### Date Progression Settings (`[date_progression]` section)
 73- **verses_per_day**: Number of verses to read per day (default: 12)
 74- **start_date**: Start date for yearly progression (format: "1 January", empty
 75for current year)
 76
 77### Example Configuration
 78
 79See `configs/config.example.toml` in the project directory for a complete example.
 80
 81### Generating Configuration
 82
 83Generate a default configuration file:
 84
 85```bash
 86./bibel --generate-config
 87```
 88
 89### Command Line Arguments
 90
 91Command line arguments override configuration file settings:
 92
 93- `-r, --reading`: "evangelion" (four Gospels; *default*), "new_testament",
 94"old_testament", "bible" (default: "evangelion")
 95- `-p, --plain`: Output plain text without formatting or TUI
 96- `-f, --formatted`: Output formatted text with ANSI colours (no TUI)
 97- `-g, --generate-config`: Generate a default configuration file and exit
 98- `-c, --config`: Path to configuration file (not yet implemented)
 99
100## Data Format
101
102The Bible data is in JSON format (see `books/pol_nbg.json`) with the following
103structure:
104```json
105{
106  "metadata": { ... },
107  "verses": [
108    {
109      "book_name": "Mateusza",
110      "book": 40,
111      "chapter": 1,
112      "verse": 1,
113      "text": "¶ KSIĘGA początku Jezusa Chrystusa..."
114    },
115    ...
116  ]
117}
118```
119
120Books 40-43 correspond to the four Gospels:
121- 40: Matthew (Mateusza)
122- 41: Mark (Marek)
123- 42: Luke (Łukasz)
124- 43: John (Jana)
125
126## Date-Based Algorithm
127
128The program calculates reading position as follows:
129
1301. **Day of Year**: Get current day number (1-366)
1312. **Verse Offset**: Multiply by 12 verses per day: `offset = (day_of_year - 1)
132   × 12`
1333. **Modulo Wrap**: Apply modulo with total Gospel verses (3779) to cycle
134   yearly
1354. **Position Mapping**: Walk through Gospels to find corresponding verses
1365. **Lookahead Rule**: Extend to chapter end if less than 12 verses remain
137
138## Project Structure
139
140```
141.
142├── cmd/bibel.go             # Main CLI entry point
143├── configs/                 # Default configuration files
144│   └── config.example.toml  # The default configuration file
145├── internal/
146│   ├── config.go            # Reading and writing to config
147│   ├── dateprogression.go   # Date-based position calculation
148│   ├── verse.go             # Data structures
149│   ├── loader.go            # JSON loading and indexing
150│   ├── formatter.go         # Output formatting
151│   └── tui/                 # Terminal User Interface
152│       └── model.go         # bubbletea TUI model and styling
153├── books/pol_nbg.json       # Bible data
154├── go.mod                   # Go module dependencies
155└── go.sum                   # Go dependency checksums
156```
157
158## Examples
159
160- **1 January**: Matthew 1:1-12
161- **2 January**: Matthew 1:13-25 (extends to end of chapter)
162- **16 April**: Mark 5:41-43
163- **31 December**: Matthew 18:7-18 (year wraps around)
164
165## Development
166
167```bash
168# Build
169go build ./cmd/bibel.go
170
171# Run
172./bibel
173```