Something went wrong. Try again.
Mirroring: https://github.com/MunifTanjim/scripts.sh
Something went wrong. Try again.
scripts.sh setup-bat
720 B · 49 lines
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#!/usr/bin/env bash
set -euo pipefail
command_exists() { type "${1}" >/dev/null 2>&1}
ensure_tool() { local -r tool="${1}" if ! type "${tool}" >/dev/null 2>&1; then echo "missing required tool: ${tool}" exit 1 fi}
setup_for_darwin() { ensure_tool brew
echo 'brew "bat"' | brew bundle --file=-}
setup_for_debian() { local pattern="_amd64.deb" if test "$(uname -m)" = "aarch64"; then pattern="arm64.deb" fi
setup-from-github-release "sharkdp/bat" "${pattern}"}
setup_bat() { case $OSTYPE in darwin*) setup_for_darwin ;; linux*) if command_exists dpkg; then setup_for_debian fi ;; *) echo "Unknown OS!" exit 1 ;; esac}
setup_bat