#!/usr/bin/env bash ############################################################################### # Script Name: script-name.sh # Description: Brief description of what the script does # Author: DevOps Team # Created: $(date +%Y-%m-%d) # Last Modified: $(date +%Y-%m-%d) # Version: 1.0.0 # # Usage: # ./script-name.sh [options] [arguments] # # Options: # -h, --help Show this help message # -v, --verbose Enable verbose output # -d, --dry-run Perform a dry run without making changes # # Environment Variables: # REQUIRED_VAR Description of required variable # OPTIONAL_VAR Description of optional variable # # Exit Codes: # 0 Success # 1 General error # 2 Invalid arguments # 3 Missing dependencies # # Examples: # ./script-name.sh --verbose # ./script-name.sh --dry-run ############################################################################### set -euo pipefail # Get script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" # Source common libraries source "$SCRIPT_DIR/../lib/init.sh" source "$SCRIPT_DIR/../lib/common/error-handling.sh" # Setup error handling setup_error_traps # Default values VERBOSE="${VERBOSE:-0}" DRY_RUN="${DRY_RUN:-0}" # Parse command line arguments parse_args() { while [[ $# -gt 0 ]]; do case "$1" in -h|--help) show_help exit 0 ;; -v|--verbose) VERBOSE=1 LOG_LEVEL=$LOG_LEVEL_DEBUG shift ;; -d|--dry-run) DRY_RUN=1 shift ;; *) log_error "Unknown option: $1" show_help exit 2 ;; esac done } # Show help message show_help() { cat <