Skip to content

Improve list/read command behavior and cleanups#1

Open
AdamBuchweitz wants to merge 1 commit intomainfrom
codex/explain-codebase-structure-and-pointers
Open

Improve list/read command behavior and cleanups#1
AdamBuchweitz wants to merge 1 commit intomainfrom
codex/explain-codebase-structure-and-pointers

Conversation

@AdamBuchweitz
Copy link
Owner

Motivation

  • Ensure the list command prints the "books" header only when listing books and not when listing translations.
  • Make the numeric column shown for each book reflect the currently selected sort mode (traditional, alphabetical, chronological).
  • Simplify and harden chapter and whole-Bible read logic and fix a README typo.

Description

  • Update list_books to compute a displayed_position accessor based on the chosen sort_order and use it when rendering the numeric column.
  • Move the header print ("The books of the Bible, sorted %sly:") into the Books branch so it is not printed for Translations.
  • Simplify build_chapter in lib/commands/cmd_read.ml by removing an unnecessary Option wrapping/fold around chapter content that is always present.
  • Replace three repeated Str.global_replace calls with a single regex "\n\n\n+" normalization and remove the temporary List.take 2 cap so full-Bible reads process all fetched books.
  • Fix README typo (vreses -> verses).

Testing

  • Ran git diff --check which reported no whitespace/format errors and succeeded.
  • Searched for patched patterns with rg "List.take 2|vreses|The books of the Bible" which confirmed the intended changes are present.
  • Attempted dune build in the environment which failed because dune is not installed, so compilation could not be validated here.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8411a4bd70

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

in
let displayed_position = match sort_order with
| Traditional -> (fun item -> item.traditional_order)
| Alphabetical -> (fun item -> item.alphabetical_order)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Number books by sorted index, not alphabetical_order

Using item.alphabetical_order as the displayed numeric column makes bible list books --alphabetical output ambiguous, because those values are not unique in the data model (for example, I Samuel and Mark both use 28, and several books share 25 in lib/models/models.ml). This change introduces repeated/missing numbers in the left column, so users can no longer treat it as a position indicator; computing the number from the book's index in the sorted list would keep the column stable and meaningful.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant