Skip to content

Releases: jdevera/jdvlib.sh

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 22 Mar 18:55

What's new

  • macOS 15 & 16 support — sys::macos_code_name now recognises Sequoia and Tahoe
  • Portable architecture detection — sys::get_arch uses uname -m instead of Debian-only dpkg
  • Unknown flag warnings — ansi::style now warns on stderr instead of silently ignoring bad flags
  • Colour value validation — ansi::style validates --color=N and --rgb=R,G,B inputs

Bug fixes

  • user::group_exists — removed stray getent call that broke macOS support
  • fs::is_in_remote_mount — fixed broken regex ([cifs|nfs] → (cifs|nfs)) and escaped literal paths in grep
  • env::dotenv_delete — replaced sed -i with portable grep -v + mv pattern (fixes macOS)
  • sys::run_as — shell-escape arguments with printf %q to preserve boundaries in su -c; use id -un instead of $USER
  • fmt::bytes — handle zero (returns "0 B") and negative values (returns error); fix awk code injection via -v variable passing
  • text::filter_inside_markers — preserve leading whitespace (IFS= read)
  • text::apply_in_place — clean up temp file on filter failure
  • user::is_in_group — replace groups with id -nG and grep \b with grep -qxF for cross-platform support
  • pve::is_lxc — handle NUL-delimited /proc/1/environ correctly with tr
  • sys::is_in_path — use grep -qxF for literal matching (dots no longer match any character)
  • code::is_sourced — compare with realpath so symlinks work correctly
  • func::list_functions_in_file — fix wrong function name in error message

Security hardening

  • env::dotenv_load — replaced blind source with a line-by-line parser that validates assignment patterns before eval, rejecting arbitrary commands
  • env::dotenv_save — quote values with printf %q to preserve special characters
  • Variable name validation — dotenv_delete, dotenv_save, and ensure_is_set now reject invalid names, preventing regex injection
  • Literal marker matching — all text.sh marker functions use exact string comparison instead of regex, preventing metacharacter injection
  • Nameref collision prevention — prefixed internal locals with __jdvlib_ in args::get_flag_value and all env.sh functions

Platform guards

  • user::add_to_groups and user::create now fail explicitly on macOS via sys::ensure_linux
  • fs::is_in_remote_mount gated to Linux (uses mountpoint which is Linux-only)
  • meta::for_each_library_module returns an error in compiled mode

Infrastructure

  • Double-source guard — meta::import tracks imported modules to prevent infinite recursion from circular imports
  • Deleted deprecated text::replace_between_markers_legacy (hardcoded tmpfile bug)
  • Added bc to Docker test image
  • Parallel test execution support

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 19 Mar 01:39

Breaking Changes

  • Replaced vendored 118-function ansi module with minimal 5-function implementation (ansi::style, ansi::cursor, ansi::display, ansi::term, ansi::isSupported)
  • Removed deprecated compat module and all legacy function wrappers

New Features

  • ansi::style supports FORCE_COLOR and NO_COLOR environment variables
  • func::exists — check if a function is defined
  • func::call_first_matching, func::call_first_of — call first matching callable from a list
  • sys::run_first_of — run first available command from a list
  • sys::is_docker_running / sys::ensure_docker_running
  • sys::macos_version / sys::macos_code_name added to README

Improvements

  • code::script_dir handles repeated BASH_SOURCE entries
  • Compiler uses pure text processing instead of source() overrides
  • Removed __jdvlib_compiling flag (no longer needed)
  • Auto-detect install destination in Makefile based on user

Infrastructure

  • Pre-commit hooks: shellcheck, shdoc-ng, trailing whitespace, end-of-file, merge conflicts
  • Pre-push hook runs tests
  • Automated GitHub release workflow on version tags
  • GitHub Actions checkout bumped to v6

Documentation

  • All modules documented with shdoc-ng annotations
  • Compiled bundle includes @name/@section blocks for shdoc-ng generation
  • Module descriptions sourced from @section (replaced jdvlib:doc blocks)

Full Changelog: 0.0.6...v0.1.0

0.0.6

Choose a tag to compare

@jdevera jdevera released this 21 Dec 17:26

Full Changelog: 0.0.5...0.0.6

MacOS versions and bytes conversions

Choose a tag to compare

@jdevera jdevera released this 21 Dec 13:43

Full Changelog: 0.0.4...0.0.5