2021-12-21 02:44:51 +00:00
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
⚡️hello() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Say hello!"
|
2021-12-21 02:44:51 +00:00
|
|
|
|
echo Hello, world!
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 04:51:18 +00:00
|
|
|
|
⚡️build() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Build an incredible script"
|
2021-12-21 19:15:24 +00:00
|
|
|
|
mkdir -p .generated
|
2021-12-21 10:06:18 +00:00
|
|
|
|
echo 'echo hi; echo "$@"' > .generated/potato
|
2021-12-21 04:51:18 +00:00
|
|
|
|
chmod +x .generated/potato
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️run() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Run the script"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
⚡️build
|
|
|
|
|
.generated/potato "$@"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️check() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Verify the script passes shellcheck"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
⚡️build
|
|
|
|
|
shellcheck .generated/potato
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️test() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Test output of the script"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
⚡️build
|
|
|
|
|
[ "$(.generated/potato)" == "hi" ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️clean() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Delete generated GARBAGE"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
rm -rf .generated
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️good() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Show a nice message for something nice happening"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
_good-message + Good Message
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
⚡️bad() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Show a bad message for something bad happening"
|
2021-12-21 04:51:18 +00:00
|
|
|
|
_bad-message - Bad Message
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 05:10:46 +00:00
|
|
|
|
_verify-prerequisites() {
|
|
|
|
|
if ! [[ -f /tmp/banana ]]; then
|
|
|
|
|
_bad-message There\'s not enough banana
|
|
|
|
|
_bad-message touch /tmp/banana to continue
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 10:00:48 +00:00
|
|
|
|
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() {
|
2021-12-21 19:19:51 +00:00
|
|
|
|
_help-line "Show version of kubectl wrapper"
|
2021-12-21 10:00:48 +00:00
|
|
|
|
kubectlw version
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 19:15:24 +00:00
|
|
|
|
source <(cat /tmp/⚡ 2> /dev/null || curl https://apps.ofvlad.xyz/⚡ | tee /tmp/⚡)
|