core.utils.utils_version

File:

EuljiroBible/core/utils/utils_version.py

Author:

Benjamin Jaedon Choi - https://github.com/saintbenjamin

Affiliated Church:

The Eulji-ro Presbyterian Church [대한예수교장로회(통합) 을지로교회]

Address:

The Eulji-ro Presbyterian Church, 24-10, Eulji-ro 20-gil, Jung-gu, Seoul 04549, South Korea

Telephone:

+82-2-2266-3070

E-mail:

euljirochurch [at] G.M.A.I.L. (replace [at] with @ and G.M.A.I.L as you understood.)

License:

MIT License with Attribution Requirement (see LICENSE file for details); Copyright (c) 2025 The Eulji-ro Presbyterian Church.

Provides utilities for working with available Bible versions.

core.utils.utils_version.refresh_full_version_list()[source]

Scans the Bible data directory for available versions, applies sort order, and returns the list.

Example

>>> refresh_full_version_list()
['KJV', 'NIV', 'NKRV', 'RSV']
Returns:

Alphabetically or custom-ordered list of available Bible versions.

Return type:

List[str]

core.utils.utils_version.load_cli_alias_map()[source]

Load the optional CLI alias map from the configured JSON file.

The CLI alias map is a convenience layer only. It does not determine whether a Bible version is available; availability is determined from the actual files under data/.

Expected JSON shape:

{
    "대한민국 개역개정 (1998)": "NKRV",
    "영어 King James Version (1611)": "KJV"
}
Returns:

Mapping of version_key -> cli_token.

Return type:

Dict[str, str]

Note

Invalid, missing, or malformed files return an empty mapping so that the CLI can continue using raw version keys as fallback tokens.

core.utils.utils_version.build_cli_version_catalog()[source]

Build the CLI-facing version catalog from the actual data directory.

Availability is determined strictly by data/*.json. Alias files are used only to improve display labels and optional shorthand tokens.

Returns:

(entries, token_to_version, version_to_cli_label) where:

  • entries is an ordered list of catalog rows containing: version_key, display_name, and cli_label.

  • token_to_version maps accepted CLI input tokens to version keys.

  • version_to_cli_label maps version keys to the label used in CLI output/help (CLI alias when present, otherwise the raw version key).

Return type:

Tuple[List[Dict[str, str]], Dict[str, str], Dict[str, str]]

Notes

  • This function is the CLI-side source of truth for version availability.

  • aliases_version_cli.json and aliases_version.json are consulted only after the actual data file list has been collected.

  • The CLI accepts three token styles when available: explicit CLI alias, display alias, and raw version key.