Script Style Guide
All scripts in ham-apps — core and app — follow these conventions.
Shell settings
Every script starts with:
-e— exit on error-u— treat unset variables as errors-o pipefail— propagate pipe failures
Sourcing utils
Core scripts and app install/uninstall scripts source scripts/utils for shared helpers:
Logging helpers
Use these functions instead of echo:
| Function | When to use |
|---|---|
info "…" |
Normal progress messages |
success "…" |
Confirm a step completed |
warning "…" |
Non-fatal issues the user should know |
error "…" |
Fatal errors (script will exit) |
Temp directory pattern
Always use this pattern when downloading or extracting files. The trap fires on exit regardless of success or failure.
sudo usage
- App scripts use
sudoonly for the specific commands that need it (e.g.apt install, copying to/usr/local/bin) - The core runner (
ham-apps) never runs with sudo; it is up to each app script
Version strings
If a version is hardcoded, add a comment:
This flags it for review when the upstream releases a new version.
shellcheck
All scripts must pass shellcheck with no errors. Run: