lightning-runner/examples

72 lines
1.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
hello() {
_help-line "Say hello!"
echo Hello, world!
}
build() {
_help-line "Build an incredible script"
mkdir -p .generated
echo 'echo hi; echo "$@"' > .generated/potato
chmod +x .generated/potato
}
run() {
_help-line "Run the script"
build
.generated/potato "$@"
}
check() {
_help-line "Verify the script passes shellcheck"
build
shellcheck .generated/potato
}
test() {
_help-line "Test output of the script"
build
[ "$(.generated/potato)" == "hi" ]
}
clean() {
_help-line "Delete generated GARBAGE"
rm -rf .generated
}
good() {
_help-line "Show a nice message for something nice happening"
_good-message + Good Message
}
bad() {
_help-line "Show a bad message for something bad happening"
_bad-message - Bad Message
}
_verify-prerequisites() {
if ! [[ -f /tmp/banana ]]; then
_bad-message There\'s not enough banana
_bad-message touch /tmp/banana to continue
exit 1
fi
}
kubectlw() {
_wrapper \
-n kubectl \
-v v1.19.4 \
-l https://dl.k8s.io/release/VERSION/bin/linux/amd64/kubectl \
-d https://dl.k8s.io/release/VERSION/bin/darwin/amd64/kubectl \
-- \
"$@"
}
⚡kubectl-version() {
_help-line "Show version of kubectl wrapper"
kubectlw version
}
source <(cat /tmp/⚡ 2> /dev/null || curl https://apps.ofvlad.xyz/⚡ | tee /tmp/⚡)