All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
- Added `lib/utils.sh` and `lib/logging.sh` for reusable utility and logging functions. - Updated `run.sh` and `scripts/generate-changelog.sh` to use the new utility and logging functions (`validate_arg`, `log_info`, `log_error`). - Add `config.env` for better clarity and updated all references in the project. - Enhanced documentation in `README.md` to reflect the new configuration file and usage instructions. - Improved error handling and logging consistency across scripts.
25 lines
548 B
Bash
25 lines
548 B
Bash
#!/usr/bin/env bash
|
|
# utils.sh - Utility functions for the project
|
|
|
|
# Function to check if a required command is available
|
|
need() {
|
|
command -v "$1" >/dev/null || { echo "❌ $1 is required but not installed"; exit 1; }
|
|
}
|
|
|
|
# Function to log messages with levels
|
|
log() {
|
|
local level="$1"
|
|
local message="$2"
|
|
echo "[$level] $message"
|
|
}
|
|
|
|
# Function to validate input arguments
|
|
validate_arg() {
|
|
local arg_name="$1"
|
|
local arg_value="$2"
|
|
if [[ -z "$arg_value" ]]; then
|
|
log "ERROR" "Missing required argument: $arg_name"
|
|
exit 1
|
|
fi
|
|
}
|