2020-04-08 11:56:17 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# -----------------------------------------------------------------------------
|
2021-03-24 23:45:26 +01:00
|
|
|
# bat-extras | Copyright (C) 2021 eth-p | MIT License
|
2020-04-08 11:56:17 +02:00
|
|
|
#
|
|
|
|
# Repository: https://github.com/eth-p/bat-extras
|
|
|
|
# Issues: https://github.com/eth-p/bat-extras/issues
|
|
|
|
# -----------------------------------------------------------------------------
|
2020-04-28 04:05:42 +02:00
|
|
|
if [[ -z "$__LIB_CONSTANTS_INITIALIZED" ]]; then
|
|
|
|
__LIB_CONSTANTS_INITIALIZED=true
|
|
|
|
|
2020-10-29 03:15:48 +01:00
|
|
|
# Constants: Executables
|
2020-05-12 11:31:41 +02:00
|
|
|
EXECUTABLE_BAT="$(command -v bat 2>/dev/null || command -v batcat 2>/dev/null || echo "bat")"
|
2020-04-17 11:40:52 +02:00
|
|
|
EXECUTABLE_GIT="git"
|
2020-04-27 13:00:44 +02:00
|
|
|
EXECUTABLE_DELTA="delta"
|
2020-10-29 03:15:48 +01:00
|
|
|
EXECUTABLE_RIPGREP="rg"
|
|
|
|
|
|
|
|
# Constants: Program
|
2020-04-08 11:56:17 +02:00
|
|
|
PROGRAM="$(basename "$0" .sh)"
|
|
|
|
PROGRAM_HOMEPAGE="https://github.com/eth-p/bat-extras"
|
2021-03-24 23:45:26 +01:00
|
|
|
PROGRAM_COPYRIGHT="Copyright (C) 2019-2021 eth-p | MIT License"
|
2020-04-08 11:56:17 +02:00
|
|
|
PROGRAM_VERSION="$({
|
|
|
|
TOP="$(dirname "$(dirname "${BASH_SOURCE[0]}")")"
|
|
|
|
printf "%s" "$(cat "${TOP}/version.txt" 2>/dev/null || echo "unknown")"
|
|
|
|
if [[ -e "${TOP}/.git" ]]; then
|
2020-06-18 02:53:20 +02:00
|
|
|
printf "%s-git (%s)" "" "$("${EXECUTABLE_GIT}" -C "${TOP}" rev-parse --short HEAD)"
|
2020-04-08 11:56:17 +02:00
|
|
|
fi
|
|
|
|
})"
|
2020-04-28 04:05:42 +02:00
|
|
|
|
|
|
|
fi
|