diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-28 13:59:58 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-28 13:59:58 +0300 |
| commit | f905fc9da0aed140b85efd0de1f8731cef001173 (patch) | |
| tree | d46d3b02ad4ba0bf612951f15180969ac02683ce /src/lib/dry-run.source.sh | |
| parent | cf889b4cc771d44e36189d6fc09dfa23b2529bfd (diff) | |
Refactor over-length functions into ~30-line helpers (vr0)
Pure, behavior-preserving refactor: extract _-prefixed helpers from six
functions that exceeded the project's 50-line threshold, leaving each
original as a thin orchestrator. Generated HTML, dry-run output,
shuriken.json, EXIF cache behavior and the flush-grid layout are all
byte-identical (full test suite green).
Refactored:
- _generation_metadata_json -> _generation_metadata_json_head +
_generation_metadata_json_settings
- print_dry_run_plan -> _print_dry_run_settings + _print_dry_run_files
- _photo_exif_tooltip_text_from_values -> _collect_exif_tooltip_parts +
_emit_exif_tooltip_parts
- cached_photo_identify_output -> _rebuild_photo_identify_cache
- render_album_pages -> _render_album_page (one page record)
- append_preview_grid -> _roll_and_align_page_tiles + _emit_page_tiles
(uniquely-named namerefs to avoid circular-nameref)
Left intact (delicate errexit/trap management that must stay in one
function scope, where a split would change semantics):
source_template_file, refresh_splash, generate_staged,
replace_dist_with_staging.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib/dry-run.source.sh')
| -rw-r--r-- | src/lib/dry-run.source.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/dry-run.source.sh b/src/lib/dry-run.source.sh index 56244c9..eaaffeb 100644 --- a/src/lib/dry-run.source.sh +++ b/src/lib/dry-run.source.sh @@ -98,7 +98,9 @@ collect_dry_run_plan() { collect_dry_run_page_plan "$plan_name" "$image_count" } -print_dry_run_plan() { +# Print the scalar settings block (config source through tarball name plan). +# Takes the plan array NAME and re-binds its own nameref so callers stay simple. +_print_dry_run_settings() { local -r plan_name="$1"; shift # shellcheck disable=SC2178 local -n plan_ref="$plan_name" @@ -122,6 +124,14 @@ print_dry_run_plan() { printf 'Image count: %s\n' "${plan_ref["image_count"]}" printf 'Tarball setting: %s\n' "${plan_ref["tarball_include"]}" printf 'Tarball name plan: %s\n' "${plan_ref["tarball_name_plan"]}" +} + +# Print the planned directories and generated-files listing (index/favicon/json, +# image dirs, page/view/details/redirect counts, optional stats + tarball lines). +_print_dry_run_files() { + local -r plan_name="$1"; shift + # shellcheck disable=SC2178 + local -n plan_ref="$plan_name" printf 'Planned directories:\n' printf ' %s\n' "${plan_ref["dist_dir"]}" @@ -166,3 +176,12 @@ print_dry_run_plan() { "${plan_ref["dist_dir"]}" "${plan_ref["tarball_name_plan"]}" fi } + +# Thin orchestrator: print the settings block then the planned files listing. +# Output is byte-identical to the previous single-function version. +print_dry_run_plan() { + local -r plan_name="$1"; shift + + _print_dry_run_settings "$plan_name" + _print_dry_run_files "$plan_name" +} |
