all repos — bibel @ 01c758ad65f39049a6b57f85c0e09c74b5f1f1ea

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- **output_mode**: Output mode: "tui" (interactive terminal UI), "formatted"
 50(ANSI-coloured text), or "plain" (plain text)
 51- **bible_path**: Path to Bible data file (default: "books/pol_nbg.json")
 52
 53#### TUI Settings (`[tui]` section)
 54- **show_quit_message**: Whether to show "Press q to quit..." message (default:
 55true)
 56- **border_style**: Box border style: "rounded", "double", "single", or
 57"hidden" (default: "rounded")
 58- **border_colour**: Box border colour (hex or named colour, empty for
 59adaptive)
 60- **header_colour**: Header text colour (empty for adaptive)
 61- **text_colour**: Bible text colour (empty for adaptive)
 62- **quit_colour**: Quit message colour (empty for adaptive)
 63
 64#### Formatter Settings (`[formatter]` section)
 65- **use_colours**: Whether to use ANSI colours in formatted output (default:
 66true)
 67- **header_format**: Header format template with variables: {book}, {chapter},
 68{first_verse}, {second_verse}
 69
 70#### Date Progression Settings (`[date_progression]` section)
 71- **verses_per_day**: Number of verses to read per day (default: 12)
 72- **start_date**: Start date for yearly progression (format: "1 January", empty
 73for current year)
 74
 75### Example Configuration
 76
 77See `configs/config.example.toml` in the project directory for a complete example.
 78
 79### Generating Configuration
 80
 81Generate a default configuration file:
 82
 83```bash
 84./bibel --generate-config
 85```
 86
 87### Command Line Arguments
 88
 89Command line arguments override configuration file settings:
 90
 91- `-p, --plain`: Output plain text without formatting or TUI
 92- `-f, --formatted`: Output formatted text with ANSI colours (no TUI)
 93- `-g, --generate-config`: Generate a default configuration file and exit
 94- `-c, --config`: Path to configuration file (not yet implemented)
 95
 96## Data Format
 97
 98The Bible data is in JSON format (see `books/pol_nbg.json`) with the following
 99structure:
100```json
101{
102  "metadata": { ... },
103  "verses": [
104    {
105      "book_name": "Mateusza",
106      "book": 40,
107      "chapter": 1,
108      "verse": 1,
109      "text": "¶ KSIĘGA początku Jezusa Chrystusa..."
110    },
111    ...
112  ]
113}
114```
115
116Books 40-43 correspond to the four Gospels:
117- 40: Matthew (Mateusza)
118- 41: Mark (Marek)
119- 42: Luke (Łukasz)
120- 43: John (Jana)
121
122## Date-Based Algorithm
123
124The program calculates reading position as follows:
125
1261. **Day of Year**: Get current day number (1-366)
1272. **Verse Offset**: Multiply by 12 verses per day: `offset = (day_of_year - 1)
128   × 12`
1293. **Modulo Wrap**: Apply modulo with total Gospel verses (3779) to cycle
130   yearly
1314. **Position Mapping**: Walk through Gospels to find corresponding verses
1325. **Lookahead Rule**: Extend to chapter end if less than 12 verses remain
133
134## Project Structure
135
136```
137.
138├── cmd/bibel.go             # Main CLI entry point
139├── configs/                 # Default configuration files
140│   └── config.example.toml  # The default configuration file
141├── internal/  
142│   ├── bible/               # Core Bible functionality
143│   ├── config.go            # Reading and writing to config
144│   ├── dateprogression.go   # Date-based position calculation
145│   ├── verse.go             # Data structures
146│   ├── loader.go            # JSON loading and indexing
147│   ├── formatter.go         # Output formatting
148│   └── tui/                 # Terminal User Interface
149│       └── model.go         # bubbletea TUI model and styling
150├── books/pol_nbg.json       # Bible data
151├── go.mod                   # Go module dependencies
152└── go.sum                   # Go dependency checksums
153```
154
155## Examples
156
157- **1 January**: Matthew 1:1-12
158- **2 January**: Matthew 1:13-25 (extends to end of chapter)
159- **16 April**: Mark 5:41-43
160- **31 December**: Matthew 18:7-18 (year wraps around)
161
162## Development
163
164```bash
165# Build
166go build ./cmd/bibel.go
167
168# Run
169./bibel
170```