feat: add argument parsing and plain output flag - Add command-line argument parsing using `go-arg` library - Define `Args` struct with `Plain` flag (`-p/--plain`) - Implement `Description()` method for program help text - Parse arguments in `main()` before loading Bible data - Add `-p/--plain` flag to output plain text without chapter name or verse numbers - Conditionally skip header formatting when flag is set - Update `.gitignore` to exclude `bibel` binary - Remove obsolete `bibel_date` binary and `bookmark.toml` file - Update `CHANGELOG.md` with version 1.1.0 entry documenting new features - Add `github.com/alexflint/go-arg` and `go-scalar` dependencies to `go.mod` and `go.sum`
Maxwell Jensen 85795372+maxwelljens@users.noreply.github.com
Thu, 16 Apr 2026 17:08:38 +0200
7 files changed,
52 insertions(+),
10 deletions(-)
M
.gitignore
→
.gitignore
@@ -1,4 +1,5 @@
# Binaries for programs and plugins +bibel *.exe *.exe~ *.dll
M
CHANGELOG.md
→
CHANGELOG.md
@@ -8,6 +8,14 @@ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] +## [1.1.0] - 2026-04-16 + +### Added + +- Argument parsing using `go-arg` library +- `-p/--plain` flag to output plain text without chapter name or verse numbers +- Program description and help text + ## [1.0.0] - 2026-04-16 ### Added@@ -63,3 +71,8 @@
- Rewritten from OCaml to Go programming language - Changed data format from custom to JSON - Improved error handling and validation + +[unreleased]: https://github.com/maxwelljensen/bibel/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/maxwelljensen/bibel/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/maxwelljensen/bibel/compare/v0.1.0...v1.0.0 +[0.1.0]: https://github.com/maxwelljensen/bibel/releases/tag/v0.1.0
M
cmd/bibel.go
→
cmd/bibel.go
@@ -5,10 +5,25 @@ "fmt"
"os" "time" + "github.com/alexflint/go-arg" "maxwelljensen/bibel/internal" ) +// Args defines the command line arguments +type Args struct { + Plain bool `arg:"-p,--plain" help:"output plain text without chapter name or verse numbers"` +} + +// Description returns a description of the program +func (Args) Description() string { + return "Display today's Bible reading from the four Gospels (Matthew, Mark, Luke, John).\n" + + "Reads 12 verses per day based on the current date." +} + func main() { + var args Args + arg.MustParse(&args) + // Load Bible data biblePath := "books/pol_nbg.json" bibleData, err := bible.LoadBible(biblePath)@@ -17,12 +32,12 @@ fmt.Fprintf(os.Stderr, "Error loading Bible data: %v\n", err)
os.Exit(1) } - // Initialize date progression + // Initialise date progression dateProg := bible.NewDateProgression(bibleData) // Get current date currentDate := time.Now() - + // Calculate position for today todayBookmark, err := dateProg.GetPositionForDate(currentDate) if err != nil {@@ -30,10 +45,15 @@ fmt.Fprintf(os.Stderr, "Error calculating date position: %v\n", err)
os.Exit(1) } - // Initialize formatter + // Initialise formatter formatter := bible.NewFormatter() - // Print header and snippet - fmt.Println(formatter.FormatHeader(todayBookmark)) + // Print header (unless plain mode) + if !args.Plain { + fmt.Println(formatter.FormatHeader(todayBookmark)) + } + + // Print snippet fmt.Println(formatter.ExtractAndFormat(bibleData, todayBookmark)) -}+} +
M
go.sum
→
go.sum
@@ -1,2 +1,9 @@
+github.com/alexflint/go-arg v1.6.1 h1:uZogJ6VDBjcuosydKgvYYRhh9sRCusjOvoOLZopBlnA= +github.com/alexflint/go-arg v1.6.1/go.mod h1:nQ0LFYftLJ6njcaee0sU+G0iS2+2XJQfA8I062D0LGc= +github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= +github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf421CaM= github.com/pelletier/go-toml/v2 v2.3.0/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=