Update starship for version 0.54

main
Buddy Sandidge 4 years ago
parent c5092e5fa9
commit e2a852d903

@ -74,6 +74,9 @@ extract_zip () {
dest="${2}"
args="${3}"
sudo="${4}"
if [ -d "${dest}" ]; then
return
fi
mkdir_if_missing "${dest}" "${sudo}"
tmp_dir="$(mktemp -d)"
@ -89,6 +92,9 @@ extract_tarball () {
dest="${2}"
args="${3}"
sudo="${4}"
if [ -d "${dest}" ]; then
return
fi
mkdir_if_missing "${dest}" "${sudo}"
tmp_dir="$(mktemp -d)"

@ -1 +1,2 @@
eval "$(starship init bash)"
# vim: ft=bash
source <(starship init bash)

@ -13,7 +13,6 @@ format = """\
"""
[username]
style = "green"
style_user = "green"
format = "[$user]($style) "
@ -51,5 +50,4 @@ format = "[$duration]($style) "
[character]
success_symbol = "λ"
style_success = ""
error_symbol = "[☠](red)"

@ -1 +1,2 @@
eval "$(starship init zsh)"
# vim: ft=zsh
source <(starship init zsh)

@ -1,37 +1,31 @@
#!/usr/bin/env bash
APP=starship
VERSION=${VERSION:-v0.47.0}
DATA_DIR="${XDG_DATA_HOME}/apps/releases"
DEST_DIR="${DATA_DIR}/${APP}/${VERSION}"
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
OS=
ARCH=
function get_os () {
case $(uname -s) in
Linux*) OS=unknown-linux-gnu;;
Darwin*) OS=apple-darwin;;
*) >&2 echo "unsupported os"; return;
Linux*) echo unknown-linux-gnu;;
Darwin*) echo apple-darwin;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
}
function get_arch () {
case $(uname -m) in
x86_64*) ARCH=x86_64;;
x86_64*) echo x86_64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
URL="https://github.com/starship/starship/releases/download/${VERSION}/starship-${ARCH}-${OS}.tar.gz"
TMP_DIR=
if [[ ! -d "${DEST_DIR}" ]] ; then
TMP_DIR=$(mktemp --directory)
TAR_GZ="${TMP_DIR}/release.tar.gz"
curl --location --silent --output "${TAR_GZ}" "${URL}"
mkdir -p "${DEST_DIR}"
tar xzf "${TAR_GZ}" --directory "${DEST_DIR}"
rm -rf "${TMP_DIR}"
fi
APP=starship
VERSION=${VERSION:-0.54.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL="https://github.com/starship/starship/releases/download/v${VERSION}/starship-$(get_arch)-$(get_os).tar.gz"
cd "${DATA_DIR}/${APP}" || exit
[[ -s current ]] && unlink current
ln -s "${VERSION}" current
extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
cd "${XDG_BIN_HOME}" || exit
[[ -L "${APP}" ]] || ln --symbolic "${DATA_DIR}/${APP}/current/${APP}" ${APP}
cd "$XDG_BIN_HOME" || exit 1
unlink_if_set "$XDG_BIN_HOME/${APP}"
ln -s "$(relative_path "${XDG_BIN_HOME}" "${DEST}/current/${APP}")" ${APP}
cd - >/dev/null || exit 1

Loading…
Cancel
Save