Add Dry-run and Error Handling Utilities Migration to Bash#19
Merged
Conversation
- Create bin/lib/dry-run-utils.bash with comprehensive dry-run functionality - Add parse_dry_run_flags() for command line argument parsing - Add dry_run_log() for action logging without execution - Add dry_run_execute() for conditional command execution - Add 20 comprehensive unit tests covering all scenarios and edge cases - All dry-run tests pass with complete workflow integration testing - Create bin/lib/error-handling.bash with error management utilities - Add capture_error() for command execution with context and error reporting - Add retry_with_backoff() for exponential backoff retry logic - Add handle_error() for user-friendly error messages with suggestions - Support error code recognition (EACCES, ENOENT, network errors, etc.) - Provide contextual suggestions for common error scenarios - Follow established bash migration pattern with zero shellcheck warnings - Maintain feature parity with original zsh implementations - Enable safe preview mode and robust error recovery for installation scripts
- Mark PR #19 (Dry-run and Error Handling) as ready to merge - Add follow-up task for creating comprehensive error-handling tests - Update next steps to prioritize test creation for error-handling.bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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