Add Dry-run and Error Handling Utilities Migration to Bash #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
💪 What
Dry-run and Error Handling Utilities Migration: Complete migration of dry-run functionality and error handling from zsh to bash, providing safe preview mode and robust error recovery for all installation processes.
Files Changed
bin/lib/dry-run-utils.bash- Complete dry-run functionality (20 tests, all passing)bin/lib/error-handling.bash- Error handling and retry mechanisms with user-friendly suggestionstest/setup/test-dry-run-utils-bash.bats- Comprehensive unit tests for dry-run utilitiesCore Functionality Migrated
Dry-run Utilities:
parse_dry_run_flags()- Command line argument parsing for--dry-runflagdry_run_log()- Action logging with "DRY RUN:" prefix without executiondry_run_execute()- Conditional command execution based on dry-run modeError Handling Utilities:
capture_error()- Command execution with context and detailed error reportingretry_with_backoff()- Exponential backoff retry logic for network operationshandle_error()- User-friendly error messages with contextual suggestions for common error codesError Recognition and Suggestions
🤔 Why
Safe installation preview: Dry-run mode allows users to preview all installation actions without making any system changes, essential for understanding what the setup process will do.
Robust error recovery: Network operations and package installations often fail temporarily - retry logic with exponential backoff provides resilience against transient issues.
User-friendly experience: Clear error messages with actionable suggestions help users resolve issues independently rather than facing cryptic error codes.
👀 Usage
Dry-run Mode:
Error Handling:
Integration Example:
👩🔬 How to validate
Run dry-run utility tests:
Test dry-run workflow:
Test error handling:
Verify shellcheck compliance:
shellcheck bin/lib/dry-run-utils.bash shellcheck bin/lib/error-handling.bash # Both should show no warningsAll dry-run tests pass (20/20), zero shellcheck warnings, maintains complete feature parity with original zsh implementations while adding improved error handling.
🔗 Related links