36 lines
745 B
Bash
36 lines
745 B
Bash
|
#!/bin/bash
|
||
|
set -euo pipefail
|
||
|
|
||
|
#
|
||
|
# Helper functions
|
||
|
#
|
||
|
declare -i term_width=80
|
||
|
|
||
|
h1() {
|
||
|
declare border padding text
|
||
|
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
|
||
|
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
|
||
|
text="\\e[1m$*\\e[0m"
|
||
|
echo -e "$border"
|
||
|
echo -e "${padding}${text}${padding}"
|
||
|
echo -e "$border"
|
||
|
}
|
||
|
|
||
|
h2() {
|
||
|
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
|
||
|
}
|
||
|
|
||
|
k9s_version="${1:-v0.24.15}"; shift || true
|
||
|
|
||
|
h1 "Install k9s"
|
||
|
h2 "Version: ${k9s_version}"
|
||
|
|
||
|
# download and install.
|
||
|
wget -qO- "https://github.com/derailed/k9s/releases/download/$k9s_version/k9s_Linux_x86_64.tar.gz" \
|
||
|
| tar xzf - k9s
|
||
|
install -m 755 k9s /usr/local/bin/
|
||
|
rm k9s
|
||
|
|
||
|
# try it.
|
||
|
k9s version
|