mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(snippets): add bash script template
This commit is contained in:
24
snippets/script.template.bash
Normal file
24
snippets/script.template.bash
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo 'pipefail'
|
||||
|
||||
ERROR_GENERIC=1
|
||||
ERROR_REQUIRED_TOOL_MISSING=2
|
||||
|
||||
pre_flight() {
|
||||
REQUIRED_TOOLS=(
|
||||
'xargs'
|
||||
'…'
|
||||
)
|
||||
for TOOL in ${REQUIRED_TOOLS[@]}
|
||||
do
|
||||
if ! ( which "$TOOL" > '/dev/null' )
|
||||
then
|
||||
echo -e "missing required tool: $TOOL" >&2
|
||||
exit $ERROR_REQUIRED_TOOL_MISSING
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
pre_flight
|
||||
# …
|
||||
Reference in New Issue
Block a user