Compare commits

...

3 Commits

Author SHA1 Message Date
renovate[bot]
bae84c176c fix(container): update image python (3.13.3 → 3.13.4) (#119)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-05 07:45:53 +03:00
be8a6761af test: expand version comparison tests (#118) 2025-06-04 12:12:55 +03:00
c348f3625f chore(lint): fix replacable helper typo (#116)
* Fix typo in replaceable helper

* chore(docs): add docstrings to `codex/rename-replacable-to-replaceable-and-update-references` (#117)

Docstrings generation was requested by @ivuorinen.

* https://github.com/ivuorinen/dotfiles/pull/116#issuecomment-2938946257

The following files were modified:

* `scripts/install-cheat-purebashbible.sh`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-04 11:00:42 +03:00
4 changed files with 36 additions and 4 deletions

View File

@@ -1 +1 @@
3.13.3
3.13.4

View File

@@ -213,7 +213,7 @@ get_sha256sum()
# $2 - filename (string)
#
# Returns 1 when replaceable, 0 when not replaceable.
replacable()
replaceable()
{
FILE1="$1"
FILE2="$2"

View File

@@ -46,9 +46,25 @@ def test():
assert vercmp("2.4 >= 2.4")
assert vercmp("2.5 >= 2.4")
assert vercmp("3 >= 2.999")
assert vercmp("2.9 < 2.9a")
assert vercmp("2.9a < 2.9")
assert vercmp("2.9a >= 2.8")
# multiple comparisons in a single expression
assert vercmp("1.0 < 2.0 <= 2.0")
assert not vercmp("1.0 > 2.0 < 3.0")
# mixed major/minor version comparisons
assert vercmp("2 >= 1.5")
assert not vercmp("1 < 1.0")
# invalid operator should raise an error
try:
vercmp("1.0 <> 2.0")
except KeyError:
pass
else:
assert False, "invalid operator did not raise"
if __name__ == "__main__":
if len(sys.argv) == 2 and sys.argv[1] == "test":

18
scripts/install-cheat-purebashbible.sh Executable file → Normal file
View File

@@ -47,6 +47,22 @@ prepare_cheat_dest()
echo "$cheat_dest"
}
# Processes chapter files from the pure-bash-bible repository and generates or updates corresponding cheat sheets.
#
# For each chapter file, creates or updates a cheat sheet in the appropriate destination directory, removes chapter end markers, and ensures required metadata is present.
#
# Globals:
# * PBB_TEMP_DIR: Directory containing the cloned pure-bash-bible repository.
# * PBB_SYNTAX, PBB_TAGS, PBB_SOURCE: Metadata strings for cheat sheets.
#
# Outputs:
# * Writes or updates cheat sheet files in the determined cheat sheet directory.
#
# Example:
#
# ```bash
# process_chapters
# ```
process_chapters()
{
local cheat_dest
@@ -59,7 +75,7 @@ process_chapters()
header=$(grep -e '^[#] ' "$f" | head -1 | awk '{print tolower($2)}')
cheat_file="$cheat_dest/$header"
if ! replacable "$f" "$cheat_file"; then
if ! replaceable "$f" "$cheat_file"; then
cp "$f" "$cheat_file" && msg_run "Updated: $cheat_file"
fi